Question:

Write A recursive function for Binary tree Furthest Leaf???

by  |  earlier

0 LIKES UnLike

In Pseudocode could someone shoe a function in pseudo, that calculates the depth of the furthest leaf from the root (consider the root level to be 1).

Also in Pseudocode could someone show me a function that calculates the depth of the closest leaf.

 Tags:

   Report

1 ANSWERS


  1. Pseudo 'C' code:

    int deepest(node *pnode)

        {

        if ( pnode == NULL )  return 0;

        return 1 + max( deepest(pnode->left), deepest(pnode->right) );

        }

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.