Solved

Assuming a Node Class

Question 23

Essay

Assuming a Node class
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.

Correct Answer:

verifed

Verified

int depth(Node tree)
{
if (tre...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions