1.Easy
In a tree, what is a leaf?
- AA node with no children
- BA node with no parent
- CThe node with the largest value
- DA node with exactly one child
2.Easy
In a tree, what are sibling nodes?
- ANodes that have no children
- BA node and its parent
- CNodes at the same depth in different subtrees
- DNodes that share the same parent
3.Easy
What does each node in a doubly linked list contain?
- AData and a pointer to the next node only
- BData, a pointer to the next node and a pointer to the previous node
- CTwo copies of the data and one pointer
- DData and two pointers, one to the next node and one to the node after that
4.Medium
How is a new element inserted into a binary heap?
- AInsert it at its sorted position by shifting all of the larger elements one place right
- BPlace it at the end of the array and sift it up while it violates the heap property
- CRebuild the whole heap from scratch
- DPlace it at the root and sift it down
5.Medium
A circular buffer (ring buffer) is commonly used to implement:
- AA graph traversal
- BA fixed-size queue
- CA binary search tree
- DA hash function
6.Medium
AVL trees and red-black trees guarantee:
- AThat no node has two children
- BConstant-time search in every case
- CThat keys are stored in insertion order
- DO(log n) height through rebalancing
7.Hard
A segment tree is typically used to:
- ASort strings alphabetically by storing each prefix in a separate tree node
- BAnswer range queries (such as range sums) and updates in O(log n)
- CStore a graph's edges
- DImplement a stack
8.Hard
What is the running time of breadth-first search on a graph with V vertices stored as an adjacency matrix?
- AO(V + E)
- BO(V²)
- CO(E log V)
- DO(V)
Answer key
- 1. A · A node with no children
- 2. D · Nodes that share the same parent
- 3. B · Data, a pointer to the next node and a pointer to the previous node
- 4. B · Place it at the end of the array and sift it up while it violates the heap property
- 5. B · A fixed-size queue
- 6. D · O(log n) height through rebalancing
- 7. B · Answer range queries (such as range sums) and updates in O(log n)
- 8. B · O(V²)
Full step-by-step solutions: practise this topic on examproblems.com.