Binary Search Tree Simulator
Insert and delete nodes, then run in-order, pre-order, post-order and level-order traversals.
Empty tree. Every insert compares against the root and walks left for smaller, right for larger.
step 1 of 18
insertedcomparingvisited
Operations
Traversals
Tree
- Nodes
- 0 / 15
- Height (edges)
- -1
- Leaves
- 0
In-order always comes out sorted — that is the defining property of a BST. Insert 10, 20, 30, 40 in order and watch the tree degenerate into a linked list with height 3 instead of 1.
← → to step, or use the buttons above.