[algogeeks] Re: suggest simple code for

2011-08-10 Thread Don
int depth(node *root) { return root ? max(depth(root-left), depth(root-right)) : 0; } On Aug 8, 8:03 am, jagrati verma jagrativermamn...@gmail.com wrote:  finding the depth or height of a tree. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] Re: suggest simple code for

2011-08-10 Thread Don
int depth(node *root) { return root ? 1+max(depth(root-left), depth(root-right)) : 0; } On Aug 8, 8:03 am, jagrati verma jagrativermamn...@gmail.com wrote:  finding the depth or height of a tree. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

[algogeeks] Re: suggest simple code for

2011-08-10 Thread Dave
@Don: Beautiful! Dave On Aug 10, 10:03 am, Don dondod...@gmail.com wrote: int depth(node *root) {   return root ? 1+max(depth(root-left), depth(root-right)) : 0; } On Aug 8, 8:03 am, jagrati verma jagrativermamn...@gmail.com wrote:  finding the depth or height of a tree. -- You

[algogeeks] Re: suggest simple code for

2011-08-10 Thread Don
I do love functions that start with return. Don On Aug 10, 10:09 am, Dave dave_and_da...@juno.com wrote: @Don: Beautiful! Dave On Aug 10, 10:03 am, Don dondod...@gmail.com wrote: int depth(node *root) {   return root ? 1+max(depth(root-left), depth(root-right)) : 0; } On Aug 8,