Question: Q) within BinaryNode, the method getHeight returns the height of the subtree rooted at the node used to invoke the method. which one is the

Q) within BinaryNode, the method getHeight returns the height of the subtree rooted at the node used to invoke the method. which one is the getHeight method: choose one option
Q) within BinaryNode, the method getHeight returns the height of the subtree
rooted at the node used to invoke the method. which one is
the getHeight method: choose one option 1. public int getHeight() { return
getHeight(this); } // end getHeight private int getHeight(BinaryNode node) { int height
= 0; if (node != null) height = 1 + Math.max(getHeight(node.left)); return
height; } // end getHeight 2. public int getHeight() { return getHeight(this);

1. public int getHeight() { return getHeight(this); } // end getHeight private int getHeight(BinaryNode node) { int height = 0; if (node != null) height = 1 + Math.max(getHeight(node.left)); return height; } // end getHeight 2. public int getHeight() { return getHeight(this); } // end getHeight private int getHeight(BinaryNode node) { int height = 0; if (node != null) height = 1 + Math.max(getHeight(node.right)); return height: } // end getHeight 3. public int getHeight() { return getHeight(this); } // end getHeight private int getHeight(BinaryNode node) int height = 0; if (node != null) height = Math.max(getHeight(node.left), getHeight(node.right)); return height; } // end getHeight 4. public int getHeight() { return getHeight(this); } // end getHeight private int getHeight(BinaryNode node) int height = 0; if (node != null) height = Math.max(getHeight(node.left), getHeight(node.right))+1; return height; } // end getHeight 5. public int getHeight() { return getHeight(this); } // end getHeight private int getHeight(BinaryNode node) { int height = 0; if (node != null) height = Math.max(getHeight(node.left), getHeight(node.right))-1; return height; } // end getHeight 6. None of them. O 1 O2 O 3 4 O 5 O 6

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 Databases Questions!