1.Easy
In which order does a postorder traversal of a binary tree visit nodes?
- ARight subtree, then node, then left subtree
- BLeft subtree, then right subtree, then node
- CNode, then left subtree, then right subtree
- DLeft subtree, then node, then right subtree
2.Easy
What is the load factor of a hash table?
- AThe number of buckets divided by the average length of the keys stored
- BThe time needed to load the table from disk
- CThe number of collisions so far
- DThe number of stored elements divided by the number of buckets
3.Easy
A hash table stores data as:
- AA fixed-length string
- BKey–value pairs located by a hash function
- CA sorted list only
- DA tree with ordered keys
4.Medium
What happens when a hash table rehashes after its load factor exceeds a threshold?
- AOnly the colliding keys are moved to a new overflow list at the end of the table
- BThe existing keys are sorted in place
- CA larger table is allocated and every key is inserted again
- DThe oldest keys are deleted to make room
5.Medium
Which data structure is used to check whether the brackets in "{[()]}" are balanced?
- AA stack
- BA queue
- CA hash table
- DA binary search tree
6.Medium
In a binary min-heap stored in an array (index starting at 0), the children of the node at index i are at:
- A2i and 2i + 1
- B2i + 1 and 2i + 2
- Ci/2 and i/2 + 1
- Di + 1 and i + 2
7.Hard
In the BST with root 50, left subtree 30 (children 20, 40) and right subtree 70 (children 60, 80), the root is deleted using the in-order successor. Which key becomes the new root?
- A70
- B40
- C60
- D80
8.Hard
Which problem of linear probing does double hashing mainly reduce?
- APrimary clustering, where long runs of occupied slots form
- BThe need for a hash function
- CThe need to store keys in the table
- DThe O(n) cost of reading a key's value
Answer key
- 1. B · Left subtree, then right subtree, then node
- 2. D · The number of stored elements divided by the number of buckets
- 3. B · Key–value pairs located by a hash function
- 4. C · A larger table is allocated and every key is inserted again
- 5. A · A stack
- 6. B · 2i + 1 and 2i + 2
- 7. C · 60
- 8. A · Primary clustering, where long runs of occupied slots form
Full step-by-step solutions: practise this topic on examproblems.com.