• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
June 05, 2023 |2.6K Views
Check if given Binary Tree is Height Balanced or Not
  Share  3 Likes
Description
Discussion

In this video, we will discuss a problem to determine if a tree is height-balanced or not. A tree is called height balanced if the height of the left subtree and the height of the right subtree does not differ by more than one. 

For example: 

Input:
            10
           /   \
         20   30 
        /   \
     40   60

Output: 1
Explanation: The max difference in height
of left subtree and right subtree is 1.
Hence balanced.  

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-

Article:  https://www.geeksforgeeks.org/how-to-determine-if-a-binary-tree-is-balanced/
Problem: https://practice.geeksforgeeks.org/problems/check-for-balanced-tree/1
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

 

Read More