Quiz Entry - updated: 2026.12.01
Starting with an empty binary search tree used as a map, the pairs (5, Fuenf), (3, Drei), (6, Sechs), (1, Eins), (2, Zwei:1), (4, Vier:1), (4, Vier:2), (2, Zwei:2) are inserted in this order. What does the tree look like?
Root 5 with children 3 and 6; 3 has children 1 and 4; 1 has a right child 2. The last two inserts only replace values, so 4 holds Vier:2 and 2 holds Zwei:2. The height is 3.
| Insert | Search path | Effect |
|---|---|---|
| 5 | empty tree | 5 becomes the root |
| 3 | 3 < 5 | left child of 5 |
| 6 | 6 > 5 | right child of 5 |
| 1 | 1 < 5, 1 < 3 | left child of 3 |
| 2 | 2 < 5, 2 < 3, 2 > 1 | right child of 1 |
| 4 | 4 < 5, 4 > 3 | right child of 3 |
| 4 again | finds 4 | value Vier:1 → Vier:2 |
| 2 again | finds 2 | value Zwei:1 → Zwei:2 |
The deepest node is 2 at depth 3 (5 → 3 → 1 → 2), so the height is 3. Six distinct keys could fit into a tree of height 2, but the insertion order decides the shape: a binary search tree is never rebalanced on insert.
Inorder lists 1, 2, 3, 4, 5, 6, a quick check that every node landed on the correct side.