Tree implementation for TreeHeight