The idea
Key formulas
Binary search tree ordering
Loading lessons…
Just a moment, getting everything ready. The first load can take up to a minute.
Data structures and algorithms
Trace BST insertion, search, deletion, and in-order traversal, including a degenerate sorted insertion.
In a binary search tree, keys in the left subtree are smaller and keys in the right subtree are larger. Search and insertion follow one branch at each node; deletion reconnects children or replaces a two-child node with its in-order successor.
In-order traversal returns the keys in sorted order. Balanced trees support logarithmic operations, but sorted insertion can create a chain and make search, insertion, or deletion take .