Binary Search Tree Studio
Build a tree. Follow each comparison. Master the structure.
practice puzzles
LIVE STRUCTURE
Binary search tree
TRAVERSALS · CLICK TO ANIMATE
Understand a BST · deletion cases, height, balance and complexity
Ordering invariant: Every node is greater than every key in its left subtree and less than every key in its right subtree. Duplicate keys are skipped in this set-style lab.
Delete: A leaf is removed directly. A node with one child is replaced by that child. A node with two children is replaced by its in-order successor (the smallest key in its right subtree).
Time: Search, insert and delete take O(h). A balanced tree has h near log₂(n); inserting sorted values creates a chain and O(n) worst-case. This lab does not auto-rotate or rebalance.
*Balanced here means every node has child-subtree heights differing by at most one (AVL-style height balance); it is a measure, not automatic AVL behavior.
Predict the next node
Apply the BST rule to the example tree.
Choose the answer that follows the BST rule.