Here is some sample C code. The idea is to keep on moving till you hit the left most node in the tree
int minValue(struct node* node)
{
struct node* current = node;
while (current->left != NULL)
{
current = current->left;
}
return(current->data);
}
On similar lines, to find the maximum value, keep on moving till you hit the right most node of the tree.
Subscribe to:
Post Comments (Atom)
4 comments:
Thanks for the post
You can find some good Techical Interview Question Answers on in the below link
Technical Interview Question Answers
Thanks
Joya
Nice post . . Very Useful information
Dhung.com provid interview question and answer for all company.
Thanks for the info.
Regards
Educational site
If you would like to increase your experience just keep visiting this web site and be updated with the most up-to-date information posted here.
my blog post selling a wrecked car
Post a Comment