@ajay:recursively count the number of nodes then use formula  h=log2(number
of nodes)

On Wed, Jun 16, 2010 at 5:39 AM, Amir hossein Shahriari <
amir.hossein.shahri...@gmail.com> wrote:

> here's a recursive solution
>
> int depth(Node n){
>   if (n==NULL)
>       return 0;
>   else
>      return 1 + max( depth( n.right ) , depth( n.left ) );
> }
>
> calling depth(root) will yield the height of the tree
>
> On 6/15/10, 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<algogeeks%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
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.

Reply via email to