How to Use
- Insert: Enter a value and click "Insert"
- Delete: Enter a value and click "Delete"
- Search: Enter a value and click "Search"
- Random AVL Tree: Click to generate a random AVL tree
- Reset: Click to clear the tree
AVL Tree Concept
AVL Tree is a self-balancing binary search tree where the difference in heights of left and right subtrees is at most one for every node.
Key Characteristics:
- Self-balancing BST
- Height difference (balance factor) ≤ 1
- Efficient search, insert, and delete
AVL stands for Adelson-Velsky and Landis, named after the two Soviet mathematicians who invented this data structure in 1962.
AVL Tree Setup
AVL Tree Operations
Tree Visualization
Operation Steps
Purpose & Applications
- Databases and file systems
- Memory management
- Indexing and searching
- Maintaining sorted data
Time & Space Complexity
Operation | Time Complexity | Space Complexity |
---|---|---|
Insert | O(log n) | O(n) |
Delete | O(log n) | O(n) |
Search | O(log n) | O(n) |
Get Height | O(1) | O(1) |
Strengths & Limitations
Strengths:
- Always balanced for fast operations
- Guaranteed O(log n) time
Limitations:
- More rotations than other BSTs
- More complex to implement