DSA/docs/en/Tree/# AVL Tree Documentation.md

1.4 KiB

AVL Tree Documentation

An AVL tree is a self-balancing binary search tree that maintains a height-balanced property for every node in the tree. The height-balanced property ensures that the height difference between the left and right subtrees of every node is at most 1, resulting in a more balanced tree structure.

Advantages of AVL Trees

  • Fast search, insertion, and deletion: AVL trees are faster than unbalanced binary search trees for search, insertion, and deletion operations because they maintain a more balanced structure.
  • Better worst-case performance: AVL trees have a guaranteed worst-case performance of O(log n), which is faster than unbalanced binary search trees that can have a worst-case performance of O(n).

Basic Components of an AVL Tree

An AVL tree consists of nodes, each containing a value and pointers to its left and right child nodes. The height of a node is defined as the number of edges from the node to its deepest leaf. The height difference between the left and right subtrees of a node is called the balance factor, and it must be at most 1 for every node in the tree.

Implementation

Video URL

Youtube Video about AVL

Others

Wikipedia