Data structures
⏱ ~3-min readAceMark GuideWhat this topic is really about
A hash collision occurs when two distinct keys produce the same hash index, requiring the collision‑resolution strategy (e.g., chaining or open addressing) to store both items. The option that the table is full confuses collision with overflow; a full table may trigger rehashing but does not define a collision, making that distractor incorrect.
A binary tree achieves the maximum number of leaves when it is strictly binary, where every non-leaf node has exactly two children, resulting in exactly ceil(n/2) leaves. Option B is incorrect because it fails for odd values of n, such as a 3-node tree which has 2 leaves, not 1.5.
See the mechanism
A stack operates on a Last-In, First-Out (LIFO) basis, where the most recently added element is the first to be removed. A diagram for this topic isn't available yet — the worked example below walks the same reasoning step by step.
An exam-style question, fully explained
Which data structure uses LIFO ordering?
- Identify what the question tests: Which data structure uses LIFO ordering.
- A stack operates on a Last-In, First-Out (LIFO) basis, where the most recently added element is the first to be removed.
- In contrast, a queue uses First-In, First-Out (FIFO) ordering, where elements are processed in the order they arrived.
Traps the examiner sets
- A node in such a tree can contain at most m-1 keys, making option D incorrect because keys are always one fewer than the maximum children.
- The option that the table is full confuses collision with overflow; a full table may trigger rehashing but does not define a collision, making that distractor incorrect.
- Option B is incorrect because it fails for odd values of n, such as a 3-node tree which has 2 leaves, not 1.5.
Test your recall
Answer each from memory — you'll see instantly whether you're right and why.
Run a focused 10-question mini-mock on Data structures and see it stick.
Practice more of this topic →