1.Easy
Which structure is typically used to implement a priority queue?
- AA heap
- BA singly linked list without order
- CA string
- DA stack
2.Easy
What is the root of a tree?
- AThe top node with no parent
- BThe node with the largest value
- CA node with no children
- DAny node in the middle
3.Easy
Which data structure works on the principle "last in, first out"?
- ALinked list
- BHash table
- CQueue
- DStack
4.Medium
How is a new element inserted into a binary heap?
- APlace it at the root and sift it down
- BInsert it at its sorted position by shifting all of the larger elements one place right
- CPlace it at the end of the array and sift it up while it violates the heap property
- DRebuild the whole heap from scratch
5.Medium
What is the time complexity of searching for a key in a balanced binary search tree?
- AO(n log n)
- BO(n)
- CO(log n)
- DO(1)
6.Medium
How do you find the minimum key in a binary search tree?
- ALook at the root only
- BVisit every leaf and compare them
- CFollow right children from the root until there is no right child
- DFollow left children from the root until there is no left child
7.Hard
Which property keeps every B-tree perfectly balanced?
- AThe keys are stored only in the root
- BEach node stores one key
- CAll leaves are at the same depth
- DEvery node has exactly two children
8.Hard
Deleting a node with two children from a binary search tree is usually done by:
- ARemoving the whole subtree
- BReplacing it with its in-order successor (or predecessor) and deleting that node
- CRebuilding the subtree below it from scratch and reinserting every key it contained
- DSwapping it with the root
Answer key
- 1. A · A heap
- 2. A · The top node with no parent
- 3. D · Stack
- 4. C · Place it at the end of the array and sift it up while it violates the heap property
- 5. C · O(log n)
- 6. D · Follow left children from the root until there is no left child
- 7. C · All leaves are at the same depth
- 8. B · Replacing it with its in-order successor (or predecessor) and deleting that node
Full step-by-step solutions: practise this topic on examproblems.com.