1.Easy
In a binary search tree, values in the left subtree of a node are:
- ASmaller than the node's value
- BEqual to the node's value
- CLarger than the node's value
- DIn random order
2.Easy
What is the max-heap property?
- AAll leaves contain the maximum key
- BEvery left child's key is greater than or equal to its right sibling's key
- CEvery parent's key is greater than or equal to its children's keys
- DThe keys are sorted from left to right
3.Easy
What does the peek (or top) operation on a stack do?
- AReturns the bottom element of the stack
- BReturns the top element without removing it
- CRemoves the top element and returns it
- DRemoves all elements from the stack
4.Medium
Which abstract data type does Dijkstra's algorithm use to choose the next vertex to process?
- AA FIFO queue
- BA min-priority queue
- CA stack
- DA set with no ordering
5.Medium
Which data structure is used by depth-first search (iterative version)?
- AA stack
- BA heap
- CA queue
- DA hash table only
6.Medium
Which data structure does a running program use to keep track of active function calls and their local variables?
- AA binary search tree of frames
- BThe heap memory queue
- CA hash table of functions
- DThe call stack
7.Hard
A Fenwick tree (binary indexed tree) over an array of n numbers supports which operations in O(log n)?
- ASorting the array and binary search
- BFinding the median in O(1)
- CInserting elements at any position
- DPrefix-sum queries and single-element updates
8.Hard
What are the time and extra space costs of reversing a singly linked list in place?
- AO(n) time and O(1) extra space
- BO(1) time and O(1) extra space
- CO(n log n) time and O(1) extra space
- DO(n) time and O(n) extra space
Answer key
- 1. A · Smaller than the node's value
- 2. C · Every parent's key is greater than or equal to its children's keys
- 3. B · Returns the top element without removing it
- 4. B · A min-priority queue
- 5. A · A stack
- 6. D · The call stack
- 7. D · Prefix-sum queries and single-element updates
- 8. A · O(n) time and O(1) extra space
Full step-by-step solutions: practise this topic on examproblems.com.