calculates the height of a binary tree