1.Easy
What is the name of the queue operation that removes the element at the front?
- ADequeue
- BInsert
- CPush
- DEnqueue
2.Easy
In an adjacency list representation of a graph, what is stored for each vertex?
- AThe total number of edges in the graph
- BA list of its neighbouring vertices
- CThe shortest path to every other vertex
- DA row of V Boolean values
3.Easy
What is a directed graph?
- AA graph in which every pair of distinct vertices is joined by an edge
- BA graph whose edges all have weights
- CA graph whose edges have a direction from one vertex to another
- DA graph that has no cycles
4.Medium
You have a reference to a node in the middle of a list. In which list can you remove it in O(1)?
- AA dynamic array
- BA doubly linked list
- CA singly linked list
- DA sorted array
5.Medium
A node in a binary search tree has a right subtree. Where is its in-order successor?
- AIts parent, always
- BIts right child, always
- CThe rightmost node of its left subtree
- DThe leftmost node of its right subtree
6.Medium
In a hash table using open addressing, what is the maximum possible load factor?
- A1
- B0.5
- C2
- DThere is no maximum
7.Hard
Which statement about heapsort is correct?
- AIt needs a binary search tree as extra storage, so it uses O(n) extra memory
- BIt is stable and needs O(n) extra memory
- CIt sorts in place in O(n log n) worst-case time but is not stable
- DIt runs in O(n) time on any input
8.Hard
Without union by rank or path compression, what is the worst-case cost of a single find in a union-find structure with n elements?
- AO(α(n))
- BO(1)
- CO(n)
- DO(log n)
Answer key
- 1. A · Dequeue
- 2. B · A list of its neighbouring vertices
- 3. C · A graph whose edges have a direction from one vertex to another
- 4. B · A doubly linked list
- 5. D · The leftmost node of its right subtree
- 6. A · 1
- 7. C · It sorts in place in O(n log n) worst-case time but is not stable
- 8. C · O(n)
Full step-by-step solutions: practise this topic on examproblems.com.