1.Easy
What is a directed graph?
- AA graph whose edges have a direction from one vertex to another
- BA graph that has no cycles
- CA graph in which every pair of distinct vertices is joined by an edge
- DA graph whose edges all have weights
2.Easy
In a graph, what is a cycle?
- AA vertex with no edges
- BA path that starts and ends at the same vertex
- CAn edge with a weight of zero
- DA path that visits every vertex
3.Easy
What is the load factor of a hash table?
- AThe number of buckets divided by the average length of the keys stored
- BThe number of collisions so far
- CThe time needed to load the table from disk
- DThe number of stored elements divided by the number of buckets
4.Medium
A node in a binary search tree has a right subtree. Where is its in-order successor?
- AIts parent, always
- BThe rightmost node of its left subtree
- CThe leftmost node of its right subtree
- DIts right child, always
5.Medium
An in-order traversal of a binary search tree visits the keys in:
- AAscending sorted order
- BLevel order
- CInsertion order
- DDescending order always
6.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 sorted array
- BA singly linked list
- CA doubly linked list
- DA dynamic array
7.Hard
What is the running time of breadth-first search on a graph with V vertices stored as an adjacency matrix?
- AO(V²)
- BO(E log V)
- CO(V + E)
- DO(V)
8.Hard
Inserting a key into an AVL tree makes a node's left subtree too tall, and the new key went into the left subtree of its left child (left-left case). Which fix is applied?
- AA left rotation at the child, then a right rotation at the node
- BA single right rotation at the unbalanced node
- CRecolouring the node and its child
- DA single left rotation at the unbalanced node
Answer key
- 1. A · A graph whose edges have a direction from one vertex to another
- 2. B · A path that starts and ends at the same vertex
- 3. D · The number of stored elements divided by the number of buckets
- 4. C · The leftmost node of its right subtree
- 5. A · Ascending sorted order
- 6. C · A doubly linked list
- 7. A · O(V²)
- 8. B · A single right rotation at the unbalanced node
Full step-by-step solutions: practise this topic on examproblems.com.