What is a Binary Search Tree Visualizer?
A binary search tree visualizer is an interactive way to see how a BST stores values. Every node can have a left child and a right child. Values smaller than a node go to the left, and values greater than a node go to the right.
This tool lets you build a binary search tree from an insertion-order array, insert or delete individual values, search for a value, and compare common traversal orders.
If you need to preserve an exact tree shape from level-order input such as [1, null, 2, 3], use the Binary Tree Visualizer instead.
For the full cluster, browse the Data Structure Visualizers hub.
How to use this BST visualizer
- Paste an insertion-order array such as
[50, 30, 70, 20, 40, 60, 80]. - Click Build to create the binary search tree from left to right.
- Use Insert, Search, or Delete for single-value operations after the tree is built.
- Run in-order, pre-order, post-order, or level-order traversal.
- Use the highlighted nodes to follow the search path or traversal result.
The insertion order matters. The values 50, 30, 70 and 30, 50, 70 contain the same numbers, but they do not create the same tree shape.
Binary search tree traversal orders
In-order traversal visits the left subtree, then the node, then the right subtree. For a binary search tree, this returns the values in sorted order.
Pre-order traversal visits the node first, then the left subtree, then the right subtree. It is useful when you want to serialize or copy the shape of a tree.
Post-order traversal visits the left subtree, then the right subtree, then the node. It is common when deleting or freeing tree nodes.
Level-order traversal visits nodes breadth first, starting at the root and moving level by level.
Why BST visualization helps
Binary search trees are easier to understand when you can see the route taken by each operation. A search begins at the root and moves left or right after each comparison. The same pattern is used when inserting a new value.
If you are learning data structures, compare this tool with the existing guides on linked list implementation in C++, queue implementation in C++, and the Stack and Queue Visualizer. Trees, linked lists, stacks, and queues are often learned together because they all focus on how data is organized and accessed.
To see how balancing changes the tree shape, open the AVL Tree Visualizer. To compare a BST with a color-balanced search tree, use the Red Black Tree Visualizer. To compare a search tree with a priority queue, use the Heap Visualizer.