1.Easy
How are the elements of an array stored in memory?
- AIn random locations chosen by a hash
- BIn a tree of memory pages
- CScattered, linked by pointers
- DIn one contiguous block, one after another
2.Easy
In which order does a postorder traversal of a binary tree visit nodes?
- ALeft subtree, then node, then right subtree
- BLeft subtree, then right subtree, then node
- CNode, then left subtree, then right subtree
- DRight subtree, then node, then left subtree
3.Easy
In a tree, what are sibling nodes?
- ANodes that have no children
- BNodes that share the same parent
- CA node and its parent
- DNodes at the same depth in different subtrees
4.Medium
How does extract-min work in a binary min-heap?
- ARemove the root and shift all elements one place left
- BMove the last element to the root and sift it down
- CRemove the last element of the array
- DSearch all leaves for the new minimum
5.Medium
AVL trees and red-black trees guarantee:
- AConstant-time search in every case
- BO(log n) height through rebalancing
- CThat keys are stored in insertion order
- DThat no node has two children
6.Medium
In a circular queue stored in an array of capacity n, how is the next position after index i computed?
- Ai + 1
- B2i + 1
- C(i − 1) mod n
- D(i + 1) mod n
7.Hard
What does a splay tree do after each access?
- AMoves the accessed node to a leaf
- BRebuilds the whole tree in balanced form
- CRecolours the nodes on the search path
- DRotates the accessed node up to the root
8.Hard
In Kruskal's minimum spanning tree algorithm, what is the union-find structure used for?
- AStoring each vertex's current distance from the source during the search
- BSorting the edges by weight
- CChoosing the starting vertex
- DChecking whether an edge's two endpoints are already connected
Answer key
- 1. D · In one contiguous block, one after another
- 2. B · Left subtree, then right subtree, then node
- 3. B · Nodes that share the same parent
- 4. B · Move the last element to the root and sift it down
- 5. B · O(log n) height through rebalancing
- 6. D · (i + 1) mod n
- 7. D · Rotates the accessed node up to the root
- 8. D · Checking whether an edge's two endpoints are already connected
Full step-by-step solutions: practise this topic on examproblems.com.