1.Easy
In a singly linked list, what does the next pointer of the last node contain?
- ANull (no node)
- BThe address of the previous node
- CThe address of the first node
- DThe number of nodes in the list
2.Easy
How many edges does a tree with n nodes have?
- A2n
- Bn
- Cn + 1
- Dn − 1
3.Easy
In an adjacency list representation of a graph, what is stored for each vertex?
- AA list of its neighbouring vertices
- BThe shortest path to every other vertex
- CThe total number of edges in the graph
- DA row of V Boolean values
4.Medium
What is the value of the postfix expression 3 4 + 2 * ?
- A14
- B10
- C24
- D11
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 / 2⌋ + 1
- BAt index i − 1
- CAt index 2i + 1
- DAt index ⌊(i − 1) / 2⌋
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
- BAll keys in a heap are equal
- CIt is a complete binary tree, so positions follow simple index formulas
- DHeaps never contain more than 100 elements
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 binary search tree rebuilt for each element
- BA hash table of all elements
- CA stack that keeps elements waiting for their answer
- DA queue that holds every pair of elements
8.Hard
What are the time and extra space costs of reversing a singly linked list in place?
- AO(n) time and O(n) extra space
- BO(1) time and O(1) extra space
- CO(n) time and O(1) extra space
- DO(n log n) time and O(1) extra space
Answer key
- 1. A · Null (no node)
- 2. D · n − 1
- 3. A · A list of its neighbouring vertices
- 4. A · 14
- 5. D · At index ⌊(i − 1) / 2⌋
- 6. C · It is a complete binary tree, so positions follow simple index formulas
- 7. C · A stack that keeps elements waiting for their answer
- 8. C · O(n) time and O(1) extra space
Full step-by-step solutions: practise this topic on examproblems.com.