Loading 3D engine…

🌳 Binary search tree

+ Insert
🎲 + Add random
🔍 Search
📈 Demo: insert in ascending order (degeneration)
↺ Reset tree
Nodes: 0
Tree height: 0
Last search: —
BST insertion: start from the root, compare values — smaller goes left, larger goes right until an empty spot is found. For a balanced tree, search runs in O(log n), but for a degenerate (‘list’) one it’s O(n).
💡 Real-world example: BSTs and their balanced variants (AVL, red-black tree) form the basis of database indexes, file systems, and autocomplete algorithms.
Drag to rotate · Scroll wheel — zoom · Insert and search values