Question: Java: 2) Assuming a Nodeclass Class node { Int element; Node left, right; Node(int el, Node left, Node right) { Element = el; This.left =
Java: 2) Assuming a Nodeclass
Class node {
Int element;
Node left, right;
Node(int el, Node left, Node right) {
Element = el; This.left = left This.right = right
}
Write a method int depth(Node tree) that returns the length of the longest path that begins at the node tree and ends at any leaf of the binary tree.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
