4.4

Trees: BST, AVL, Red-Black

Visualize binary search trees and their self-balancing variants. Watch insertions, deletions, rotations, and recoloring unfold step by step. Compare how AVL and Red-Black trees maintain balance.

Prerequisite: Binary Search, Recursion
Value:
Binary Search TreePhase: Ready
Tree is empty. Insert a value or select a scenario to begin.
Default
Searching
Found
Inserting
Visited
1.0x
Metrics
Nodes0
Height0
Comparisons0
Rotations0
BalanceN/A
Operation Log
Insert, search, or delete a value to see operations...
About Binary Search Tree

A basic BST with no balancing. Insertions follow the BST property but can lead to degenerate (linked-list) shapes.

Time Complexity
Search (avg)O(log n)
Search (worst)O(n)
Insert (avg)O(log n)
Insert (worst)O(n)
SpaceO(n)
Key Insight

A BST's performance depends entirely on its shape. Sorted input creates a degenerate tree with O(n) operations -- essentially a linked list.