Posts

Showing posts with the label Avl tree and Binary search Tree || Avl tree and Binary search Tree with example || ||Avl tree and Binary search in data structure || what is Avl tree and Binary search Tree

Avl tree and Binary search tree

  DATA STRUCTURES UNIT 5: TREES AVL TREES:-  What if the input to binary search tree comes in a sorted (ascending or descending) manner? It will then look like this – It is observed that BST's worst-case performance is closest to linear search algorithms, that is Ο(n). In real-time data, we cannot predict data pattern and their frequencies. So, a need arises to balance out the existing BST. Named after their inventor  Adelson ,  Velski  &  Landis ,  AVL trees  are height balancing binary search tree. AVL tree checks the height of the left and the right sub-trees and assures that the difference is not more than 1. This difference is called the  Balance Factor . AVL tree is a height-balanced binary search tree. That means, an AVL tree is also a binary search tree but it is a balanced tree. A binary tree is said to be balanced if, the difference between the heights of left and right subtrees of every node in the tree is either -1, 0 or +1. ...