Question: Write a method that returns the height of the binary tree when called on the node at the root of the tree. A single node

Write a method that returns the height of the binary tree when called on the node at the root of the tree. A single node tree should return one.

fill in the code accordingly(java)

public class Node {
E data;
Node leftChild;
Node rightChild;

public int getHeight() {
return 0;
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!