AlgoViz

BST Operations

Binary Search Tree allows efficient search, insert, and delete operations using the BST property.

IntermediateTime: O(log n)Space: O(h)
Take Quiz
503070204060801025354555657590
Step 1 / 0

Current Step

Click Play to start the visualization


## How BST Operations Work

A Binary Search Tree maintains the property: for each node, all values in the left subtree are smaller, and all values in the right subtree are larger.

### Search Algorithm:
1. Compare target with current node
2. If equal, found!
3. If target < current, go left
4. If target > current, go right
5. Repeat until found or reach null

### Key Characteristics:
- **Ordered structure**: Enables efficient search
- **Average O(log n)**: Balanced tree operations
- **Worst O(n)**: Unbalanced (degenerate) tree

Time & Space Complexity

CaseTime Complexity
BestO(log n)
AverageO(log n)
WorstO(n)
SpaceO(h)

Practice Problems

No Problems Available

Practice problems for this algorithm are coming soon!