Function to sum of heights of individual Nodes Uses Inorder traversal
function getTotalHeightUtil ( root ) { if ( root == null ) { return 0 ; } let lh = getTotalHeightUtil ( root . left ) ; let rh = getTotalHeightUtil ( root . right ) ; let h = Math . max ( lh , rh ) + 1 ; sum = sum + h ; return h ; } function getTotalHeight ( root ) { sum = 0 ; getTotalHeightUtil ( root ) ; return sum ; }