Skip to content
Treesintro

BST Insertion

Builds a binary search tree by inserting values one at a time. Each new key descends from the root — going left when smaller, right when larger — until it finds an empty slot, preserving the BST ordering invariant.

Best
O(log n)
Average
O(log n)
Worst
O(n)
Space
O(n)