Height of a Binary Tree

Do we consider edges or nodes for finding the height of a binary tree? I am getting mixed answers. If I consider edges of this tree,


then its height will be 2 but if I consider nodes then its height will be 3.
Please Clarify

As, The Maximum depth in a tree is height of that tree , and while talking about depth we consider the maximum number of edges from root to that node.

Hi Raghav .
You are supposed to count the no of nodes and not the number of edges. The method to calculate height of a tree is
Height = max( leftSubTreeHeight , rightSubTreeHeight ) + 1 ;

Depth and Height are one or the same thing.

We can use recursion to calculate this.

You can refer to this code for further clarity -https://ide.codingblocks.com/s/93770

Thank you! @tarunluthra, though, I had the code, just wanted to know the case!