1.Easy
How many edges does a tree with n nodes have?
- An + 1
- B2n
- Cn
- Dn − 1
2.Easy
Where is the smallest element of a binary min-heap found?
- AIn any leaf, which must be searched
- BIn the leftmost leaf
- CAt the root
- DIn the last array position
3.Easy
In a hash table, what is a collision?
- AA key cannot be hashed at all
- BTwo equal keys are stored twice
- CThe table runs out of memory
- DTwo different keys map to the same index
4.Medium
Why is traversing an array often much faster in practice than traversing a linked list of the same length?
- AArrays use fewer instructions to compare values
- BArray traversal is O(1) in total, while linked list traversal is O(n)
- CArray elements are contiguous, so they make good use of the CPU cache
- DLinked lists always store elements on disk
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:
- A2i and 2i + 1
- Bi + 1 and i + 2
- Ci/2 and i/2 + 1
- D2i + 1 and 2i + 2
6.Medium
Which data structure is used by depth-first search (iterative version)?
- AA hash table only
- BA stack
- CA queue
- DA heap
7.Hard
Which pair of traversals always determines a unique binary tree with distinct keys?
- APreorder alone
- BLevel-order alone
- CPreorder and inorder
- DPreorder and postorder
8.Hard
A Bloom filter can answer "is this element in the set?" with:
- APossible false positives but no false negatives
- BExact answers always
- CAnswers only for numbers
- DPossible false negatives but no false positives
Answer key
- 1. D · n − 1
- 2. C · At the root
- 3. D · Two different keys map to the same index
- 4. C · Array elements are contiguous, so they make good use of the CPU cache
- 5. D · 2i + 1 and 2i + 2
- 6. B · A stack
- 7. C · Preorder and inorder
- 8. A · Possible false positives but no false negatives
Full step-by-step solutions: practise this topic on examproblems.com.