Solved

Assuming a Node Class

Question 43

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

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents