1.Easy
What is the main difference between a static array and a dynamic array?
- AA dynamic array can grow by moving to a larger block of memory
- BA static array allows slower index access
- CA dynamic array stores its elements in linked nodes so it can grow one at a time
- DA static array can only store numbers
2.Easy
What does each node in a doubly linked list contain?
- AData, a pointer to the next node and a pointer to the previous node
- BData and two pointers, one to the next node and one to the node after that
- CTwo copies of the data and one pointer
- DData and a pointer to the next node only
3.Easy
Which data structure works on the principle "first in, first out"?
- AStack
- BHeap
- CQueue
- DBinary tree
4.Medium
How do you find the minimum key in a binary search tree?
- AFollow right children from the root until there is no right child
- BLook at the root only
- CVisit every leaf and compare them
- DFollow left children from the root until there is no left child
5.Medium
You have a reference to a node in the middle of a list. In which list can you remove it in O(1)?
- AA dynamic array
- BA doubly linked list
- CA sorted array
- DA singly linked list
6.Medium
How long does a search for a word of length L take in a trie with a fixed alphabet?
- AO(log n), where n is the number of words
- BO(n), where n is the number of words
- CO(L), independent of how many words are stored
- DO(L × n)
7.Hard
The union-find (disjoint set) structure with union by rank and path compression has an amortised cost per operation of:
- AO(log n) exactly
- BO(α(n)), the inverse Ackermann function, which is practically constant
- CO(n)
- DO(n²)
8.Hard
Which statement about heapsort is correct?
- AIt runs in O(n) time on any input
- BIt is stable and needs O(n) extra memory
- CIt needs a binary search tree as extra storage, so it uses O(n) extra memory
- DIt sorts in place in O(n log n) worst-case time but is not stable
Answer key
- 1. A · A dynamic array can grow by moving to a larger block of memory
- 2. A · Data, a pointer to the next node and a pointer to the previous node
- 3. C · Queue
- 4. D · Follow left children from the root until there is no left child
- 5. B · A doubly linked list
- 6. C · O(L), independent of how many words are stored
- 7. B · O(α(n)), the inverse Ackermann function, which is practically constant
- 8. D · It sorts in place in O(n log n) worst-case time but is not stable
Full step-by-step solutions: practise this topic on examproblems.com.