Tree Visualizer
Binary Search Trees
Build a BST, trace search decisions, and step through inorder traversal with highlighted nodes and synced pseudocode.
O(n)
Step Note
Start BFS level-order traversal with the root in a queue.
function levelOrder(root: Node | null) {
const queue = root ? [root] : []
while (queue.length > 0) {
const node = queue.shift()
visit(node)
if (node.left) queue.push(node.left)
if (node.right) queue.push(node.right)
}
}