1.Easy
Which operation is slow in an array but fast at the head of a linked list?
- AInserting at the beginning
- BFinding the length of a fixed array
- CReading the last element by index
- DAccessing the 5th element
2.Easy
How are the elements of an array stored in memory?
- AIn one contiguous block, one after another
- BIn random locations chosen by a hash
- CIn a tree of memory pages
- DScattered, linked by pointers
3.Easy
In a binary search tree, values in the left subtree of a node are:
- AEqual to the node's value
- BSmaller than the node's value
- CLarger than the node's value
- DIn random order
4.Medium
How long does it take to check whether the edge (u, v) exists using an adjacency matrix?
- AO(log V)
- BO(E)
- CO(1)
- DO(V)
5.Medium
In a binary heap stored in an array starting at index 0, where is the parent of the node at index i?
- AAt index i − 1
- BAt index ⌊i / 2⌋ + 1
- CAt index ⌊(i − 1) / 2⌋
- DAt index 2i + 1
6.Medium
A trie (prefix tree) is especially efficient for:
- APrefix searches such as autocomplete
- BStoring matrices
- CSorting numbers
- DFinding shortest paths
7.Hard
For each element of an array you want the next greater element to its right, in O(n) total time. Which structure helps?
- AA queue that holds every pair of elements
- BA binary search tree rebuilt for each element
- CA hash table of all elements
- DA stack that keeps elements waiting for their answer
8.Hard
A Fenwick tree (binary indexed tree) over an array of n numbers supports which operations in O(log n)?
- AFinding the median in O(1)
- BSorting the array and binary search
- CPrefix-sum queries and single-element updates
- DInserting elements at any position
Answer key
- 1. A · Inserting at the beginning
- 2. A · In one contiguous block, one after another
- 3. B · Smaller than the node's value
- 4. C · O(1)
- 5. C · At index ⌊(i − 1) / 2⌋
- 6. A · Prefix searches such as autocomplete
- 7. D · A stack that keeps elements waiting for their answer
- 8. C · Prefix-sum queries and single-element updates
Full step-by-step solutions: practise this topic on examproblems.com.