The recursive step

i am able to understand how recursion is working here as its inside a if block.please explain it with a help of recursion tree or diagram.
my code is https://ide.codingblocks.com/s/116574
the problem in following step

    if (lh - rh <= 1
        && isBalanced(node.left) 
        && isBalanced(node.right)) 
        return true;

@vaibhavgupta.1919
The code inside if block:

if (lh - rh <= 1
&& isBalanced(node.left)
&& isBalanced(node.right))
return true;

A non-empty binary tree T is balanced if:

  1. Left subtree of T is balanced
  2. Right subtree of T is balanced
  3. The difference between heights of left subtree and right subtree is not more than 1.
    The if block is checking that by making recursive call to left subtree first and then right subtree first,if all the above three condition satisfies then only the code is returning TRUE,else if any of the condition fails we are returning FALSE.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.