Why it matters
BST is foundation for sorted maps. Understanding shapes all balanced trees.
Advertisement
The architecture
Node: key + left + right.
Search: compare + descend.
Insert: descend to leaf.
Delete: 3 cases.
Advertisement
How it works end to end
Balanced: O(log n).
Unbalanced worst: O(n).
Delete: leaf, one child, two children (in-order successor).