1.Easy
A hash table stores data as:
- AA tree with ordered keys
- BKey–value pairs located by a hash function
- CA sorted list only
- DA fixed-length string
2.Easy
What is the root of a tree?
- AThe top node with no parent
- BAny node in the middle
- CThe node with the largest value
- DA node with no children
3.Easy
In a singly linked list, what does the next pointer of the last node contain?
- AThe number of nodes in the list
- BThe address of the previous node
- CThe address of the first node
- DNull (no node)
4.Medium
A trie (prefix tree) is especially efficient for:
- AStoring matrices
- BSorting numbers
- CFinding shortest paths
- DPrefix searches such as autocomplete
5.Medium
What is the worst-case height of a binary search tree with n nodes if keys are inserted in sorted order?
- Alog₂ n
- B√n
- Cn (it becomes a linked list)
- D1
6.Medium
A circular buffer (ring buffer) is commonly used to implement:
- AA binary search tree
- BA graph traversal
- CA fixed-size queue
- DA hash function
7.Hard
What guarantee do the red-black tree rules give about the height of a tree with n keys?
- AThe height is exactly log2 n
- BThe height is at most 2 log2(n + 1)
- CThe height is at most log2 n + 1
- DThe height is at most n / 2
8.Hard
Under simple uniform hashing, what is the expected time of a search in a hash table with chaining, n keys and m buckets?
- AO(m)
- BO(1 + α), where α = n / m
- CO(n)
- DO(log n)
Answer key
- 1. B · Key–value pairs located by a hash function
- 2. A · The top node with no parent
- 3. D · Null (no node)
- 4. D · Prefix searches such as autocomplete
- 5. C · n (it becomes a linked list)
- 6. C · A fixed-size queue
- 7. B · The height is at most 2 log2(n + 1)
- 8. B · O(1 + α), where α = n / m
Full step-by-step solutions: practise this topic on examproblems.com.