1.Easy
Which data structure is used to perform a level-order traversal of a tree?
- AQueue
- BPriority queue
- CHash table
- DStack
2.Easy
What is a deque (double-ended queue)?
- ATwo separate queues sharing one array
- BA queue that only allows removal at the back
- CA structure that allows insertion and removal at both ends
- DA queue sorted by priority
3.Easy
What is the name of the queue operation that removes the element at the front?
- ADequeue
- BEnqueue
- CPush
- DInsert
4.Medium
AVL trees and red-black trees guarantee:
- AThat keys are stored in insertion order
- BO(log n) height through rebalancing
- CThat no node has two children
- DConstant-time search in every case
5.Medium
In a binary min-heap stored in an array (index starting at 0), the children of the node at index i are at:
- Ai/2 and i/2 + 1
- Bi + 1 and i + 2
- C2i + 1 and 2i + 2
- D2i and 2i + 1
6.Medium
What is the value of the postfix expression 3 4 + 2 * ?
- A24
- B14
- C10
- D11
7.Hard
Kahn's algorithm for topological sorting repeatedly removes vertices with in-degree 0. Which structure holds those vertices?
- AAn adjacency matrix recording which vertices have already been removed
- BA max-heap ordered by out-degree
- CA queue (or any collection) of vertices whose in-degree is 0
- DA stack of all visited edges
8.Hard
Which statement about heapsort is correct?
- AIt runs in O(n) time on any input
- BIt is stable and needs O(n) extra memory
- CIt needs a binary search tree as extra storage, so it uses O(n) extra memory
- DIt sorts in place in O(n log n) worst-case time but is not stable
Answer key
- 1. A · Queue
- 2. C · A structure that allows insertion and removal at both ends
- 3. A · Dequeue
- 4. B · O(log n) height through rebalancing
- 5. C · 2i + 1 and 2i + 2
- 6. B · 14
- 7. C · A queue (or any collection) of vertices whose in-degree is 0
- 8. D · It sorts in place in O(n log n) worst-case time but is not stable
Full step-by-step solutions: practise this topic on examproblems.com.