codezonediitj / pydatastructs

A python package for data structures and algorithms
https://pydatastructs.readthedocs.io/en/stable/
Other
199 stars 269 forks source link

Add AVL Tree #469

Closed Aryan-Lohia closed 2 years ago

Aryan-Lohia commented 2 years ago

AVL tree is a self-balancing Binary Search Tree (BST) For example, On the left is an unbalanced binary search tree. And on the right is balanced AVL tree. buildBalancedBST

AVL trees increase speed when running algorithms by creating multiple branches instead of a single extending linear branch using rotation techniques. A search algorithm in the AVL tree would run with a time complexity O(log n) as compared to that in an unbalanced binary tree with a time complexity O(n).