On Mon, Aug 15, 2011 at 6:37 PM, rohit <raman.u...@gmail.com> wrote:

> Can anyone give algorithm for non recursive preorder and postorder??
>
> --
> 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/-/CMDjAwgewoYJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For pmore options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>


preorder

void preorder(struct node * root)
{
      struct stack
      {
             struct node * item[SIZE];
             int top;
     }s;


 struct node * p = root;
while(p != NULL)
{
    printf("%d",p->info);
     push(s,p);
    p = p->left;
 }
if(!empty(s))
 {
  p = pop(s);
p = p->right
  }
}while(p != null || !empty(s));

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

Reply via email to