🧮Binary Search Tree (BST)
Also known as BST, Binary Search Trees, Ordered Binary Tree
A binary tree kept in order. Small values go left; big ones go right.
Think of it like
Think of it like a guessing game. Too high, go left; too low, go right.
Example
Emma stores 1,000,000 scores in a balanced search tree. Finding one score takes about 20 steps instead of a million.
Why it matters
It gives fast search and keeps items sorted at the same time. Many database indexes use a close cousin of it.
Definition
Common mistake
Key takeaways
- 1Left is smaller. Right is bigger.
- 2Fast search. When it stays balanced.
- 3Keeps order. Read it left to right.