Back to Browse

AVL Tree Deletion

24.1K views
Jul 27, 2024
22:59

An AVL tree, named after its inventors Adelson-Velsky and Landis, is a special type of Binary Search Tree (BST) that keeps itself balanced. This means that the height difference between the left and right subtrees of any node is no more than one. You can insert, delete, and search for items in an AVL tree just like in a BST. To stay balanced, an AVL tree can rotate its subtrees in four ways: left rotation (when a new node makes the right side too tall), right rotation (when a new node makes the left side too tall), left-right rotation (a left rotation followed by a right rotation), and right-left rotation (a right rotation followed by a left rotation). AVL trees are useful for indexing large databases, searching data quickly, and are used in in-memory collections like sets and dictionaries. They are beneficial because they balance themselves, aren't skewed, provide faster lookups than Red-Black Trees, and have a height that doesn't exceed log(N) where N is the total number of nodes. However, they are hard to implement, have high constant factors for some operations, are less common than Red-Black trees, involve complicated insertions and deletions due to frequent rotations, and require more processing to maintain balance.

Download

0 formats

No download links available.

AVL Tree Deletion | NatokHD