Binary Search Tree Visualizer

Overview

The Binary Search Tree Visualizer lets you build and manipulate BSTs interactively. Insert and delete nodes, search for values, and watch tree traversals unfold in real-time. The visualization automatically positions nodes and displays important tree properties like height and balance status. Perfect for understanding how BSTs maintain their ordering property and why balanced trees are important.

Open in new tab

Tips

  • Start by inserting a few values to build a simple tree - the root is always the first value inserted
  • Notice how the BST property is maintained: left subtree < node < right subtree
  • Try inserting sorted values (1, 2, 3, 4, 5) to see a degenerate tree - it becomes a linked list!
  • Generate a balanced tree to see the optimal structure - height is minimized
  • Search operations highlight the path taken - notice how it’s like binary search on a sorted array
  • The tree height directly affects performance - balanced trees have O(log n) operations
  • Use traversals to see different orderings: in-order gives sorted output, pre-order is useful for copying
  • Deleting nodes with two children is the most complex case - watch how it finds the in-order successor