Topic 2 built two extremes: arrays/hash tables (fast lookup, no order) and linked lists (fast front insertion, slow everything else). The binary search tree (BST) is the first structure in the vault to offer search, insertion, deletion, and ordered traversal simultaneously, where is the tree's height. This note builds the BST invariant and its core operations, then exposes the structure's central weakness — height depends entirely on insertion order, and an adversarial order collapses to — which is precisely the problem red-black trees solve next.
In this lesson
- Learning objectives
- The BST invariant
- Core operations, all
- The height problem
Before you start
The full lesson, with worked examples and exercise solutions, is for members.
Read the full lessonNew to SelfMadeQuant.com? See membership options or explore the curriculum.