1.Easy
The height of a tree is commonly defined as:
- AThe total number of nodes in the tree, counting the root and every leaf
- BThe number of leaves in the tree
- CThe number of children of the root
- DThe number of edges on the longest path from the root to a leaf
2.Easy
What is the load factor of a hash table?
- AThe number of collisions so far
- BThe time needed to load the table from disk
- CThe number of stored elements divided by the number of buckets
- DThe number of buckets divided by the average length of the keys stored
3.Easy
What is the name of the stack operation that adds an element to the top?
- APush
- BPeek
- CEnqueue
- DPop
4.Medium
How much memory does an adjacency list use for a graph with V vertices and E edges?
- AO(V × E)
- BO(V + E)
- CO(E²)
- DO(V²)
5.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
- CAt index ⌊(i − 1) / 2⌋
- DAt index 2i + 1
6.Medium
In a hash table using open addressing, what is the maximum possible load factor?
- AThere is no maximum
- B2
- C0.5
- D1
7.Hard
Which property must a red-black tree satisfy?
- AEvery path from a node to its descendant leaves has the same number of black nodes
- BEvery node must be red
- CThe root must be red
- DEvery red node must have red children, so red nodes always form unbroken chains to the leaves
8.Hard
Which property keeps every B-tree perfectly balanced?
- AEach node stores one key
- BThe keys are stored only in the root
- CEvery node has exactly two children
- DAll leaves are at the same depth
Answer key
- 1. D · The number of edges on the longest path from the root to a leaf
- 2. C · The number of stored elements divided by the number of buckets
- 3. A · Push
- 4. B · O(V + E)
- 5. C · At index ⌊(i − 1) / 2⌋
- 6. D · 1
- 7. A · Every path from a node to its descendant leaves has the same number of black nodes
- 8. D · All leaves are at the same depth
Full step-by-step solutions: practise this topic on examproblems.com.