1.Easy
In a binary search tree, values in the left subtree of a node are:
- AIn random order
- BEqual to the node's value
- CLarger than the node's value
- DSmaller than the node's value
2.Easy
In an undirected graph, what is the degree of a vertex?
- AThe length of the longest path from it
- BIts position in the adjacency list
- CThe number of edges connected to it
- DThe number of vertices in the graph
3.Easy
A hash table stores data as:
- AKey–value pairs located by a hash function
- BA fixed-length string
- CA sorted list only
- DA tree with ordered keys
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?
- A4 2 5 1 3
- B4 5 2 3 1
- C5 4 3 2 1
- D1 2 4 5 3
5.Medium
Which collision resolution method stores colliding keys in a list at the same bucket?
- ASeparate chaining
- BLinear probing
- CQuadratic probing
- DDouble hashing
6.Medium
How do you find the minimum key in a binary search tree?
- ALook at the root only
- BVisit every leaf and compare them
- CFollow right children from the root until there is no right child
- DFollow left children from the root until there is no left child
7.Hard
Why do databases often use B+ trees rather than plain B-trees for indexes?
- AB+ trees store data only in the root
- BAll records are in linked leaves, which makes range scans efficient
- CB+ trees use binary internal nodes, which reduces the number of disk reads
- DB+ trees do not need to be balanced
8.Hard
The time complexity of decrease-key in a binary heap (given the element's position) is:
- AO(log n)
- BO(n)
- CO(n log n)
- DO(1)
Answer key
- 1. D · Smaller than the node's value
- 2. C · The number of edges connected to it
- 3. A · Key–value pairs located by a hash function
- 4. B · 4 5 2 3 1
- 5. A · Separate chaining
- 6. D · Follow left children from the root until there is no left child
- 7. B · All records are in linked leaves, which makes range scans efficient
- 8. A · O(log n)
Full step-by-step solutions: practise this topic on examproblems.com.