Height-balanced trees

Tree Type Algorithm Algorithm Gist Time Complexity
Binary Tree Recursion Recursively find the height of the left and right sub-trees at every node and check if the sub-tress are height-balanced. O(N^2)
Binary Tree Tree-traversal 1. Traverse the tree till the leaf node is reached and return its height to the parent.
2. The parent node gets the height of the left and right sub-trees and checks if they are height balanced.
3. The parent returns its own height as 1 + Maximum (Height of left sub-tree, Height of right sub-tree) .
O(N)

Copyright (c) 2019-2020, Algotree.org.
All rights reserved.