Re: [algogeeks] Re: Maximum height/depth of tree

2012-03-11 Thread saurabh singh
Quoting from wikipedia:
The *depth* (or *height*) of a tree is the length of the path from the root
to the deepest node in the tree.

However notice *length *is not defined and is left on the intuition.So *both
answers 2 and 3 are correct if we follow the above definition.* However the
next line on wiki entry says *A (rooted) tree with only one node (the
root) has a depth of zero. **So this line suggests the height should be 2.
*But in either case I don't think any sane computer scientist/programmer
will worry about whether the answer should be 2 or 3.After all the answer
differs by a constant factor.All depends on how you want to implement
it.Somewhat similar question can be whether 0 is a positive number?
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Sun, Mar 11, 2012 at 12:44 PM, rahul sharma rahul23111...@gmail.comwrote:

 but according to the o/p it should be 3i also concerned from the data
 structure and algo book it is also giving same answer.so the
 height/depth is the number of nodes in largest pathis it rigt???


 On Sun, Mar 11, 2012 at 12:10 PM, Sonia Keys soniak...@gmail.com wrote:

 Correct is always whatever the specification says.  You may think
 something else is more conventional, or something else may seem right to
 you, but none of that matters if there are clear instructions otherwise.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/xmJbzvy_X6sJ.

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Maximum height/depth of tree

2012-03-10 Thread Sonia Keys
Correct is always whatever the specification says.  You may think something 
else is more conventional, or something else may seem right to you, but 
none of that matters if there are clear instructions otherwise.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/xmJbzvy_X6sJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Maximum height/depth of tree

2012-03-10 Thread rahul sharma
but according to the o/p it should be 3i also concerned from the data
structure and algo book it is also giving same answer.so the
height/depth is the number of nodes in largest pathis it rigt???

On Sun, Mar 11, 2012 at 12:10 PM, Sonia Keys soniak...@gmail.com wrote:

 Correct is always whatever the specification says.  You may think
 something else is more conventional, or something else may seem right to
 you, but none of that matters if there are clear instructions otherwise.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/xmJbzvy_X6sJ.

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.