BTW where i can find this kind "(lheight > rheight ? lheight : rheight)"
syntax tutorial or smth ?

On 3/6/07, Nat (Padmanabhan Natarajan) <[EMAIL PROTECTED]> wrote:
>
> The system uses only one stack to implement recursion, so you should be
> able to do it too :-)
>
> On 3/6/07, NUPUL < [EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > On Feb 28, 8:06 pm, "k3xji" < [EMAIL PROTECTED]> wrote:
> >
> > > Is there any way of calculating the depth of a binary tree without
> > > using *recursive way*.Also not using *log2-1* method.I am asking this
> > > because Is there any way of doing this kind of operation with just
> > > using stacks or quenes.
> >
> > Yes. You can "simulate" recursion by explicitly creating your own
> > stack and storing the pointers to the traversed nodes OR Create a
> > threaded (inorder) binary tree, this too eliminates the need of
> > recursion when traversing the tree in order.
> >
> > This solution is offered in a standard book on data structures by
> > Tanenbaum.
> >
> > >In other words, is there a some kind of
> > > compiler optimization just to avoid recursive call overhead?
> >
> > Not an optimization per se but the above avoids the recursion overhead
> >
> > >Here is
> > > the recursive one (pseudo): Any comments?(Also optimization is not
> > > important here.Is it just possible to implement an algorithm using one
> > > stack or one quene,like traversal methods do?)
> >
> > Which "other" traversal methods are you talking about? The 'graph'
> > traversal methods are usually specified recursively as they are easier
> > to read/understand that way.
> >
> > Regards,
> >
> > Nupul
> >
> >
> >
> >
> >
>
> >
>


-- 
You can contact me by :
   msn messanger: [EMAIL PROTECTED]
   yahoo messanger: [EMAIL PROTECTED]
   ICQ: 443443043
   Google Talk: [EMAIL PROTECTED]
   Skype: halfas.online.now
   IRC: HalFas`  (irc2.omnitel.net)
   Home page: http://www.revidev.com/halfas/
   One's leisure project: http://rvision.gamedev.lt/RVengine

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to