@sharad height will be log2(n) only in case of balanced BST. what if its terribly unbalanced, you may get height as 'n' as well ! :) So you will have to go till the bottom of the tree to see the depth and find the height accordingly.
Anurag Sharma On Wed, Jun 16, 2010 at 9:12 AM, Anurag Sharma <anuragvic...@gmail.com>wrote: > height of current node = max(height of left child, height of right child) > +1 > > Hope now you get that? :) > > Anurag Sharma > > > On Tue, Jun 15, 2010 at 5:31 PM, ajay kumar <ajaykr....@gmail.com> wrote: > >> Write a pseudo code 4 that..using c/c++....... >> >> how can we find the depth(height) of BST ????????? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algoge...@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@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.