1.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 a pointer to the next node only
- CData and two pointers, one to the next node and one to the node after that
- DTwo copies of the data and one pointer
2.Easy
How many edges does a tree with n nodes have?
- An + 1
- Bn − 1
- Cn
- D2n
3.Easy
What is the root of a tree?
- AAny node in the middle
- BA node with no children
- CThe top node with no parent
- DThe node with the largest value
4.Medium
A binary tree has root 1 with left child 2 and right child 3; node 2 has children 4 (left) and 5 (right). What is the postorder traversal?
- A5 4 3 2 1
- B4 5 2 3 1
- C1 2 4 5 3
- D4 2 5 1 3
5.Medium
A queue is implemented with two stacks: push onto an "in" stack, and pop from an "out" stack, refilling it from "in" when empty. What is the amortised cost per operation?
- AO(log n)
- BO(n)
- CO(1)
- DO(n²)
6.Medium
In a hash table using open addressing, what is the maximum possible load factor?
- A0.5
- BThere is no maximum
- C1
- D2
7.Hard
Inserting a key into an AVL tree makes a node's left subtree too tall, and the new key went into the left subtree of its left child (left-left case). Which fix is applied?
- AA single right rotation at the unbalanced node
- BA single left rotation at the unbalanced node
- CRecolouring the node and its child
- DA left rotation at the child, then a right rotation at the node
8.Hard
In a circular buffer, front == rear can mean either empty or full. What is a common way to tell them apart?
- AStore the front and rear in the same variable
- BAlways clear the buffer whenever front equals rear, so the state is empty
- CMake the buffer size a power of two
- DKeep a separate element count, or always leave one slot unused
Answer key
- 1. A · Data, a pointer to the next node and a pointer to the previous node
- 2. B · n − 1
- 3. C · The top node with no parent
- 4. B · 4 5 2 3 1
- 5. C · O(1)
- 6. C · 1
- 7. A · A single right rotation at the unbalanced node
- 8. D · Keep a separate element count, or always leave one slot unused
Full step-by-step solutions: practise this topic on examproblems.com.