Docsity

Midterm Exam 1 - Data Structures and Programming | ECS 110, Exams of Data Structures and Algorithms

Partial preview of the text

Download Midterm Exam 1 - Data Structures and Programming | ECS 110 and more Exams Data Structures and Algorithms in PDF only on Docsity!

ECS 110

Data Structures and Programming

Midterm Examination

Name__________________________________________________

Directions:

This is a closed-book test. Answer all questions on the paper

provided. Use the backs of the provided paper if you need

extra space.

  1. What are the primary operations of a stack? What are the primary operations of a queue?
  1. What are the advantages of a doubly-linked list over a singly-linked list? What are the disadvantages? Be complete here!
  1. Given the list of integers

4, 7, 10, 3, 2, 9, 1, 5

exhibit a binary tree that, when traversed in inorder, outputs the list in ascending order.

  1. Given the list of integers

4, 7, 3, 10, 2, 9, 1, 5, 12

Add each of these integers to a Min heap. Show the structure of the heap before and after each insertion. Note: We want the minimum value at the top.

  1. The solution to the subway problem is frequently called a “backtracking” algorithm. Explain this term as it applies to the subway problem.
  1. Illustrate a binary search tree which is not an AVL tree, but one that can be made into an AVL tree by using one single rotation. Show the result of the single rotation on the tree.