1.Easy
In a hash table, what is a collision?
- ATwo equal keys are stored twice
- BThe table runs out of memory
- CA key cannot be hashed at all
- DTwo different keys map to the same index
2.Easy
What is the root of a tree?
- AThe top node with no parent
- BAny node in the middle
- CA node with no children
- DThe node with the largest value
3.Easy
What is the max-heap property?
- AEvery parent's key is greater than or equal to its children's keys
- BAll leaves contain the maximum key
- CThe keys are sorted from left to right
- DEvery left child's key is greater than or equal to its right sibling's key
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?
- A1 2 4 5 3
- B5 4 3 2 1
- C4 2 5 1 3
- D4 5 2 3 1
5.Medium
In a binary min-heap stored in an array (index starting at 0), the children of the node at index i are at:
- Ai + 1 and i + 2
- Bi/2 and i/2 + 1
- C2i + 1 and 2i + 2
- D2i and 2i + 1
6.Medium
An in-order traversal of a binary search tree visits the keys in:
- AInsertion order
- BAscending sorted order
- CLevel order
- DDescending order always
7.Hard
A Bloom filter can answer "is this element in the set?" with:
- AAnswers only for numbers
- BExact answers always
- CPossible false positives but no false negatives
- DPossible false negatives but no false positives
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(n)
- BO(m)
- CO(1 + α), where α = n / m
- DO(log n)
Answer key
- 1. D · Two different keys map to the same index
- 2. A · The top node with no parent
- 3. A · Every parent's key is greater than or equal to its children's keys
- 4. D · 4 5 2 3 1
- 5. C · 2i + 1 and 2i + 2
- 6. B · Ascending sorted order
- 7. C · Possible false positives but no false negatives
- 8. C · O(1 + α), where α = n / m
Full step-by-step solutions: practise this topic on examproblems.com.