1.Easy
What is the max-heap property?
- AThe keys are sorted from left to right
- BEvery parent's key is greater than or equal to its children's keys
- CEvery left child's key is greater than or equal to its right sibling's key
- DAll leaves contain the maximum key
2.Easy
The depth of a node in a tree is:
- AThe number of edges from the root to that node
- BThe number of nodes in its subtree
- CThe number of children of that node
- DThe number of edges from that node to the deepest leaf
3.Easy
What does a hash function do in a hash table?
- AEncrypts the values in the table
- BSorts the keys in the table
- CCounts how many keys are stored
- DMaps a key to an index in the table
4.Medium
How does extract-min work in a binary min-heap?
- ASearch all leaves for the new minimum
- BRemove the last element of the array
- CMove the last element to the root and sift it down
- DRemove the root and shift all elements one place left
5.Medium
Which data structure is used by depth-first search (iterative version)?
- AA queue
- BA heap
- CA hash table only
- DA stack
6.Medium
What is the worst-case height of a binary search tree with n nodes if keys are inserted in sorted order?
- A1
- Bn (it becomes a linked list)
- Clog₂ n
- D√n
7.Hard
What does a splay tree do after each access?
- ARebuilds the whole tree in balanced form
- BRecolours the nodes on the search path
- CMoves the accessed node to a leaf
- DRotates the accessed node up to the root
8.Hard
A segment tree is typically used to:
- ASort strings alphabetically by storing each prefix in a separate tree node
- BStore a graph's edges
- CAnswer range queries (such as range sums) and updates in O(log n)
- DImplement a stack
Answer key
- 1. B · Every parent's key is greater than or equal to its children's keys
- 2. A · The number of edges from the root to that node
- 3. D · Maps a key to an index in the table
- 4. C · Move the last element to the root and sift it down
- 5. D · A stack
- 6. B · n (it becomes a linked list)
- 7. D · Rotates the accessed node up to the root
- 8. C · Answer range queries (such as range sums) and updates in O(log n)
Full step-by-step solutions: practise this topic on examproblems.com.