Data Structures
8 questions
Q1
What is the internal path length of a BST built by inserting: 50, 30, 70, 20, 40?
Q2
In a min-heap, after inserting 5, 3, 8, 1, 4 (in that order), what value is at the root?
Q3
A stack contains (bottom to top): 5, 8, 3. After PUSH(7) and then two POP operations, what value is on top of the stack?
Q4
Build a BST by inserting these values in order: 50, 30, 70, 20, 40, 60. What is the inorder traversal?
Q5
A queue contains (front to back): A, B, C. After ENQUEUE(D), DEQUEUE(), ENQUEUE(E), DEQUEUE(), what is at the front?
Q6
Build a BST by inserting: 40, 20, 60, 10, 30, 50, 70. What is the preorder traversal?
Q7
What is the postorder traversal of a BST built by inserting: 30, 10, 50, 20, 40?
Q8
A stack is initially empty. After these operations, what is the value of Z?
PUSH(4)
PUSH(9)
X = POP()
PUSH(X + 3)
PUSH(7)
Y = POP()
Z = POP()