Tree Visualizer
Binary Search Trees
Build a BST, trace search decisions, and step through inorder traversal with highlighted nodes and synced pseudocode.
O(h)
Step Note
Search for 42 from the root.
function search(root: Node | null, target: number) {
let current = root
while (current) {
if (current.value === target) return current
if (target < current.value) current = current.left
else current = current.right
}
return null
}