

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 9
click for more info
Not enough gems
Cost: 6 gems
1: Trees
incomplete
2: Binary Trees
incomplete
3: Insert Nodes
incomplete
4: Insert Review
incomplete
5: Min and Max
incomplete
6: Delete
incomplete
7: Deletion Review
incomplete
8: Preorder Traversal
incomplete
9: Postorder Traversal
incomplete
10: Inorder Traversal
incomplete
11: Node Exists
incomplete
12: Height
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Our DevOps team has been concerned with the hardware required to run the software using our BST. In an effort to diagnose the issue, they've asked us to write a method that returns the height of the tree. For example, this tree:
> Elrond#3
> Elian#2
> Astram#1
Has a height of 2 because the longest path from the root node to a leaf node is 2 nodes long.
Complete the height method. It returns the height of the tree rooted at the current node.