1.Easy
In a binary search tree, values in the left subtree of a node are:
- ASmaller than the node's value
- BLarger than the node's value
- CIn random order
- DEqual to the node's value
2.Easy
Which structure is typically used to implement a priority queue?
- AA singly linked list without order
- BA heap
- CA string
- DA stack
3.Easy
The height of a tree is commonly defined as:
- AThe number of leaves in the tree
- BThe total number of nodes in the tree, counting the root and every leaf
- CThe number of edges on the longest path from the root to a leaf
- DThe number of children of the root
4.Medium
How long does a search for a word of length L take in a trie with a fixed alphabet?
- AO(log n), where n is the number of words
- BO(L), independent of how many words are stored
- CO(L × n)
- DO(n), where n is the number of words
5.Medium
How does extract-min work in a binary min-heap?
- ARemove the last element of the array
- BMove the last element to the root and sift it down
- CSearch all leaves for the new minimum
- DRemove the root and shift all elements one place left
6.Medium
A road network has 100,000 junctions, each connected to about 4 others. Which representation is most suitable?
- AAdjacency list
- BA single sorted array of vertices
- CA binary heap of edges
- DAdjacency matrix
7.Hard
You must keep the k smallest values from a stream of n numbers using O(k) memory. Which approach works in O(n log k) time?
- AA max-heap of size k, replacing its root when a smaller value arrives
- BA FIFO queue of the last k values
- CA sorted array of all n values
- DA min-heap holding all n values, from which the k smallest are popped at the end
8.Hard
A Bloom filter can answer "is this element in the set?" with:
- AAnswers only for numbers
- BPossible false negatives but no false positives
- CPossible false positives but no false negatives
- DExact answers always
Answer key
- 1. A · Smaller than the node's value
- 2. B · A heap
- 3. C · The number of edges on the longest path from the root to a leaf
- 4. B · O(L), independent of how many words are stored
- 5. B · Move the last element to the root and sift it down
- 6. A · Adjacency list
- 7. A · A max-heap of size k, replacing its root when a smaller value arrives
- 8. C · Possible false positives but no false negatives
Full step-by-step solutions: practise this topic on examproblems.com.