1.Easy
In a binary search tree, values in the left subtree of a node are:
- AEqual to the node's value
- BSmaller than the node's value
- CLarger than the node's value
- DIn random order
2.Easy
In a singly linked list, each node contains:
- AData and references to all other nodes
- BData and an index
- COnly data
- DData and a reference to the next node
3.Easy
A graph consists of:
- AOnly a root and leaves
- BVertices (nodes) connected by edges
- CKeys and hashes only
- DRows and columns
4.Medium
A trie (prefix tree) is especially efficient for:
- AFinding shortest paths
- BStoring matrices
- CPrefix searches such as autocomplete
- DSorting numbers
5.Medium
An application needs fast lookups and also needs to list keys in sorted order and answer range queries. Which structure fits best?
- AA stack
- BA hash table
- CA balanced binary search tree
- DAn unsorted linked list
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 dynamic array
- BA doubly linked list
- CA singly linked list
- DA sorted array
7.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(n)
- CO(log n)
- DO(1)
8.Hard
How does a radix tree (compressed trie) improve on a plain trie?
- AIt keeps only the first letter of each word
- BIt merges chains of single-child nodes into one edge labelled with a string
- CIt sorts the children of each node by frequency
- DIt stores each word in a hash table at the root instead of in separate nodes
Answer key
- 1. B · Smaller than the node's value
- 2. D · Data and a reference to the next node
- 3. B · Vertices (nodes) connected by edges
- 4. C · Prefix searches such as autocomplete
- 5. C · A balanced binary search tree
- 6. B · A doubly linked list
- 7. B · O(n)
- 8. B · It merges chains of single-child nodes into one edge labelled with a string
Full step-by-step solutions: practise this topic on examproblems.com.