1st if condition is true only if there is no node in binary tree.
2nd if condition told if there is only 1 node in the tree.Then height of tree is 0.
Now,
if the tree has at least one left node, then it is going to calculate B2
otherwise, if the tree has only right subtree, tree height calculated by B1 only
B1= right subtree+1 to get height of the tree
Now, h1= height of right subtree of a node
h2= height of left subtree of a node
height of a tree= 1+ max(h1,h2)