Jan 3, 2009

you are given a binary tree....write a code that returns the leaf node present at topmost level.... two leafs may be present at same level (take care

you are given a binary tree....write a code that returns the leaf node
present at topmost level....
two leafs may be present at same level
(take care of this condition)
use bfs
or

int lowleaf(node *root)
{
if(root==NULL) return 0;
else
return 1+min(lowleaf(root->left),lowleaf(root->right));
}

No comments:

Post a Comment