1.Easy
How many edges does a tree with n nodes have?
- An − 1
- Bn
- C2n
- Dn + 1
2.Easy
Which structure is typically used to implement a priority queue?
- AA stack
- BA string
- CA singly linked list without order
- DA heap
3.Easy
What does a map (dictionary) store?
- AOnly values in insertion order
- BValues sorted by size
- CPairs of equal keys
- DKey-value pairs with unique keys
4.Medium
How do you find the minimum key in a binary search tree?
- AFollow left children from the root until there is no left child
- BLook at the root only
- CFollow right children from the root until there is no right child
- DVisit every leaf and compare them
5.Medium
What is the cost of inserting an element in the middle of an array of n elements?
- AO(1), because the index is known
- BO(n²), because each element moves n times
- CO(n), because later elements must shift
- DO(log n), because of binary search
6.Medium
Why can a binary heap be stored in an array without any pointers?
- AArrays automatically keep the keys in sorted order, so no pointers are needed
- BHeaps never contain more than 100 elements
- CIt is a complete binary tree, so positions follow simple index formulas
- DAll keys in a heap are equal
7.Hard
In a hash table using open addressing, why is deletion often done with a "tombstone" marker?
- ATombstones speed up hashing
- BEmptying the slot could break the probe sequence for other keys
- CIt makes the table sorted
- DDeleted keys must be kept forever for security, so slots can never be reused
8.Hard
For a hash table to work correctly, which rule must hash and equality follow?
- AEqual hash values imply equal keys
- BEqual keys must have equal hash values
- CHash values must be prime numbers
- DDifferent keys must have different hash values
Answer key
- 1. A · n − 1
- 2. D · A heap
- 3. D · Key-value pairs with unique keys
- 4. A · Follow left children from the root until there is no left child
- 5. C · O(n), because later elements must shift
- 6. C · It is a complete binary tree, so positions follow simple index formulas
- 7. B · Emptying the slot could break the probe sequence for other keys
- 8. B · Equal keys must have equal hash values
Full step-by-step solutions: practise this topic on examproblems.com.