Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write code for finding depth of tree

Answer Posted / crispin

/*
* Simple tree node representation
*/
struct node_t {
struct node_t *left;
struct note_t *right;
};

/*
* Return the maximum depth of the tree given a pointer
* to its root node.
*/
unsigned int
tree_depth (node_t *root)
{
return (NULL == root) ? 0 :
MAX(tree_depth(root->left, root->right)+1);
}

Is This Answer Correct ?    3 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is meant by errors and debugging?

1111


What does c in a circle mean?

1080


What are the uses of null pointers?

1127


Write a program to use switch statement.

1134


How to delete a node from linked list w/o using collectons?

2782


Why flag is used in c?

1134


What does != Mean in c?

1055


Between macros and functions,which is better to use and why?

2228


Which is better oop or procedural?

1071


how many key words availabel in c a) 28 b) 31 c) 32

1081


What is calloc malloc realloc in c?

1059


What are 'near' and 'far' pointers?

1045


How do you generate random numbers in C?

1201


Can we add pointers together?

1060


What are the string functions? List some string functions available in c.

992