1.Easy
What does each node in a doubly linked list contain?
- AData, a pointer to the next node and a pointer to the previous node
- BData and two pointers, one to the next node and one to the node after that
- CTwo copies of the data and one pointer
- DData and a pointer to the next node only
2.Easy
What is the load factor of a hash table?
- AThe number of buckets divided by the average length of the keys stored
- BThe time needed to load the table from disk
- CThe number of stored elements divided by the number of buckets
- DThe number of collisions so far
3.Easy
What is a directed graph?
- AA graph whose edges all have weights
- BA graph in which every pair of distinct vertices is joined by an edge
- CA graph whose edges have a direction from one vertex to another
- DA graph that has no cycles
4.Medium
In a binary heap stored in an array starting at index 0, where is the parent of the node at index i?
- AAt index ⌊i / 2⌋ + 1
- BAt index ⌊(i − 1) / 2⌋
- CAt index 2i + 1
- DAt index i − 1
5.Medium
An in-order traversal of a binary search tree visits the keys in:
- ALevel order
- BInsertion order
- CDescending order always
- DAscending sorted order
6.Medium
Which abstract data type does Dijkstra's algorithm use to choose the next vertex to process?
- AA stack
- BA FIFO queue
- CA min-priority queue
- DA set with no ordering
7.Hard
Which problem of linear probing does double hashing mainly reduce?
- AThe need for a hash function
- BThe O(n) cost of reading a key's value
- CPrimary clustering, where long runs of occupied slots form
- DThe need to store keys in the table
8.Hard
What are the time and extra space costs of reversing a singly linked list in place?
- AO(n log n) time and O(1) extra space
- BO(1) time and O(1) extra space
- CO(n) time and O(1) extra space
- DO(n) time and O(n) extra space
Answer key
- 1. A · Data, a pointer to the next node and a pointer to the previous node
- 2. C · The number of stored elements divided by the number of buckets
- 3. C · A graph whose edges have a direction from one vertex to another
- 4. B · At index ⌊(i − 1) / 2⌋
- 5. D · Ascending sorted order
- 6. C · A min-priority queue
- 7. C · Primary clustering, where long runs of occupied slots form
- 8. C · O(n) time and O(1) extra space
Full step-by-step solutions: practise this topic on examproblems.com.