1.Easy
What does a map (dictionary) store?
- APairs of equal keys
- BOnly values in insertion order
- CKey-value pairs with unique keys
- DValues sorted by size
2.Easy
What does each node in a doubly linked list contain?
- ATwo copies of the data and one pointer
- BData, a pointer to the next node and a pointer to the previous node
- CData and two pointers, one to the next node and one to the node after that
- DData and a pointer to the next node only
3.Easy
What is a deque (double-ended queue)?
- ATwo separate queues sharing one array
- BA structure that allows insertion and removal at both ends
- CA queue sorted by priority
- DA queue that only allows removal at the back
4.Medium
What happens when a hash table rehashes after its load factor exceeds a threshold?
- AThe oldest keys are deleted to make room
- BThe existing keys are sorted in place
- COnly the colliding keys are moved to a new overflow list at the end of the table
- DA larger table is allocated and every key is inserted again
5.Medium
How long does a search for a word of length L take in a trie with a fixed alphabet?
- AO(L), independent of how many words are stored
- BO(n), where n is the number of words
- CO(log n), where n is the number of words
- DO(L × n)
6.Medium
An in-order traversal of a binary search tree visits the keys in:
- AInsertion order
- BDescending order always
- CLevel order
- DAscending sorted order
7.Hard
For each element of an array you want the next greater element to its right, in O(n) total time. Which structure helps?
- AA stack that keeps elements waiting for their answer
- BA binary search tree rebuilt for each element
- CA hash table of all elements
- DA queue that holds every pair of elements
8.Hard
How long does it take to search for an arbitrary key in a binary min-heap of n elements?
- AO(log n)
- BO(1)
- CO(log log n)
- DO(n)
Answer key
- 1. C · Key-value pairs with unique keys
- 2. B · Data, a pointer to the next node and a pointer to the previous node
- 3. B · A structure that allows insertion and removal at both ends
- 4. D · A larger table is allocated and every key is inserted again
- 5. A · O(L), independent of how many words are stored
- 6. D · Ascending sorted order
- 7. A · A stack that keeps elements waiting for their answer
- 8. D · O(n)
Full step-by-step solutions: practise this topic on examproblems.com.