Tree Visualizer
Binary Search Trees
Build a BST, trace search decisions, and step through inorder traversal with highlighted nodes and synced pseudocode.
O(h) per insert
Step Note
Start with an empty binary search tree.
function insert(root: Node | null, value: number) {
if (!root) return new Node(value)
if (value < root.value) {
root.left = insert(root.left, value)
} else {
root.right = insert(root.right, value)
}
return root
}