Function to sum of heights of individual Nodes Uses Inorder traversal
int getTotalHeightUtil ( struct Node * root , int & sum ) { if ( root == NULL ) return 0 ; int lh = getTotalHeightUtil ( root -> left , sum ) ; int rh = getTotalHeightUtil ( root -> right , sum ) ; int h = max ( lh , rh ) + 1 ; sum = sum + h ; return h ; } int getTotalHeight ( Node * root ) { int sum = 0 ; getTotalHeightUtil ( root , sum ) ; return sum ; }