Binary Search Tree

Interactive tree operations: insert nodes, search for values, and visualize tree traversal

Speed:
Default
Comparing
Found/Inserted
Not Found

About BST

Time Complexity:

  • Best: O(log n) - balanced tree
  • Average: O(log n)
  • Worst: O(n) - skewed tree

Space Complexity: O(n)

Properties:

  • Left subtree < node value
  • Right subtree > node value
  • No duplicate values

How It Works

A Binary Search Tree maintains a sorted structure where each node's left child is smaller and right child is larger than the parent.

This property enables efficient searching, insertion, and deletion operations with O(log n) average time complexity.

💡 Tip: Try inserting sorted values to see how the tree becomes unbalanced!