On Mon, Aug 15, 2011 at 6:37 PM, rohit <[email protected]> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.