1.Easy
Which operation is slow in an array but fast at the head of a linked list?
- AAccessing the 5th element
- BReading the last element by index
- CInserting at the beginning
- DFinding the length of a fixed array
2.Easy
Which data structure is used to perform a level-order traversal of a tree?
- AStack
- BPriority queue
- CHash table
- DQueue
3.Easy
In a tree, what is a leaf?
- AA node with no children
- BA node with exactly one child
- CA node with no parent
- DThe node with the largest value
4.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/2 and i/2 + 1
- Bi + 1 and i + 2
- C2i and 2i + 1
- D2i + 1 and 2i + 2
5.Medium
In a circular queue stored in an array of capacity n, how is the next position after index i computed?
- A(i − 1) mod n
- B(i + 1) mod n
- Ci + 1
- D2i + 1
6.Medium
What balance condition does an AVL tree maintain at every node?
- AEvery node is coloured red or black
- BBoth subtrees of every node contain exactly the same number of nodes
- CAll leaves are at exactly the same depth
- DThe heights of the left and right subtrees differ by at most 1
7.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(m)
- BO(1 + α), where α = n / m
- CO(n)
- DO(log n)
8.Hard
What is the main advantage of a skip list over a sorted linked list?
- AGuaranteed O(1) search because every node stores a pointer to every other node
- BIt uses no extra memory
- CExpected O(log n) search by using several levels of forward pointers
- DIt stores keys without order
Answer key
- 1. C · Inserting at the beginning
- 2. D · Queue
- 3. A · A node with no children
- 4. D · 2i + 1 and 2i + 2
- 5. B · (i + 1) mod n
- 6. D · The heights of the left and right subtrees differ by at most 1
- 7. B · O(1 + α), where α = n / m
- 8. C · Expected O(log n) search by using several levels of forward pointers
Full step-by-step solutions: practise this topic on examproblems.com.