//Slow version

 

int Tree::BranchHeight(TreeNode * ptrNode)

{

       if (ptrNode==NULL)

              return 0;

 

       else if (BranchHeight(ptrNode->Left) > BranchHeight(ptrNode->Right))

              return 1+BranchHeight(ptrNode->Left);

 

       else

              return 1+BranchHeight(ptrNode->Right);

}

 

int Tree::Height()

{

       return BranchHeight(Root);

}