BST – Set 1

BST Visualizer  BST Complexity In a complete(almost)  binary tree number of nodes (n) and height of tree (h) have a relationship like => n = 2^(h+1) -1,   this is the all the nodes of the tree. Conversely if we have n nodes in a complete(almost) BT then height of the tree will be floor(log(n)), (base 2) this… Continue reading BST – Set 1

Advertisements

Self Balancing Binary Tree

AVL Tree Implementation. Code. GFG - Insert, Delete  Youtube Time Complexity: The rotation operations (left and right rotate) take constant time as only few pointers are being changed there. Updating the height and getting the balance factor also take constant time. So the time complexity of AVL insert remains same as BST insert which is O(h) where… Continue reading Self Balancing Binary Tree