Posts

Showing posts from May, 2020

AVL Tree and B-Tree

Image
AVL Tree and B-Tree AVL Tree ·        Introduction Before we dive into the AVL tree, we should review Binary Tree. The binary tree is one of the data structures, it features sorting, ease insertion and deletion, and searching, although being able to search at a fast rate, the binary tree has a weakness. The quickness of the methods in a binary tree depends on the height of the tree, moreover it can be as large as n-1 when it's skewed, furthermore, if this happens the searching, deletion, and insertion method’s rate will be comparable to linear search. The AVL Tree takes to resolve the weakness of the binary tree by commencing rotation’s when the tree is Imbalance. The goal of this balancing is to rotate the binary tree until it has the minimum height and. ·        Balance Factor Balance Factor is a method to adjust the balance of an AVL Tree from an imbalance state. The formula is as stated below: Balance factor = height of the left subtree – height of right sub