AVL Tree
Today let's talk about what an AVL tree is. An AVL tree is a subtype of the binary search tree. Named after it's inventors Adelson, Velskii, and Landis, and that's how they made the name AVL, taken by their initials. AVL trees have the property of dynamic self-balancing in addition to all the properties exhibited by binary search trees. Here are the operations of an AVL tree: Insertion Deletion Insertion Inserting a new node can cause the balance factor of some node to become 2 or -2. In that case, we fix the balance factors by use of rotations. Also, only the heights of the nodes on the path from the insertion point to the root can be changed. So, after inserting, we go back up to the root and update heights of the nodes and if we find any node with a balance factor of 2 or -2, we fix it by rotation. There are two rotations, which are the left rotation and the right rotation. Here are steps to follow for insertion: ...