ldiameter -- > diameter of left subtree rdiameter -- > Diameter of right subtree Get the heights of left and right subtrees in lh and rh And store the returned values in ldiameter and ldiameter
int ldiameter = diameterOpt ( root . left , lh ) ; int rdiameter = diameterOpt ( root . right , rh ) ;