1.Easy
How many edges does a tree with n nodes have?
- An − 1
- Bn + 1
- Cn
- D2n
2.Easy
Which structure is typically used to implement a priority queue?
- AA heap
- BA stack
- CA singly linked list without order
- DA string
3.Easy
In an adjacency list representation of a graph, what is stored for each vertex?
- AA row of V Boolean values
- BThe total number of edges in the graph
- CThe shortest path to every other vertex
- DA list of its neighbouring vertices
4.Medium
A binary tree has root 1 with left child 2 and right child 3; node 2 has children 4 (left) and 5 (right). What is the postorder traversal?
- A5 4 3 2 1
- B4 5 2 3 1
- C1 2 4 5 3
- D4 2 5 1 3
5.Medium
How does extract-min work in a binary min-heap?
- ARemove the root and shift all elements one place left
- BRemove the last element of the array
- CMove the last element to the root and sift it down
- DSearch all leaves for the new minimum
6.Medium
A circular buffer (ring buffer) is commonly used to implement:
- AA graph traversal
- BA binary search tree
- CA fixed-size queue
- DA hash function
7.Hard
What does a splay tree do after each access?
- AMoves the accessed node to a leaf
- BRebuilds the whole tree in balanced form
- CRecolours the nodes on the search path
- DRotates the accessed node up to the root
8.Hard
The union-find (disjoint set) structure with union by rank and path compression has an amortised cost per operation of:
- AO(α(n)), the inverse Ackermann function, which is practically constant
- BO(n)
- CO(log n) exactly
- DO(n²)
Answer key
- 1. A · n − 1
- 2. A · A heap
- 3. D · A list of its neighbouring vertices
- 4. B · 4 5 2 3 1
- 5. C · Move the last element to the root and sift it down
- 6. C · A fixed-size queue
- 7. D · Rotates the accessed node up to the root
- 8. A · O(α(n)), the inverse Ackermann function, which is practically constant
Full step-by-step solutions: practise this topic on examproblems.com.