Binary tree
Upcoming SlideShare
Loading in...5
×
 

Binary tree

on

  • 230 views

 

Statistics

Views

Total Views
230
Views on SlideShare
230
Embed Views
0

Actions

Likes
0
Downloads
9
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Binary tree Binary tree Presentation Transcript

    • #include<stdio.h> printf("n***MENU***");#include<conio.h> printf("n1.CREATEn2.PRE-ORDER");#include<alloc.h> printf("n3.IN-ORDERn4.POST-void create(struct node *); ORDERn5.EXIT");void in_order(); printf("nPLease Enter the Choice...");void pre_order(); scanf("%d",&ch);void post_order(); switch(ch)struct node {{ case 1:root=NULL; int data; create(root);break; struct node *left,*right; case 2:pre_order();break;}*root=NULL,*New,*temp,*p,*stack[20]; case 3:in_order();break;int top=-1,flag[20],item; case 4:post_order();break;char c; case 5:exit(0); default: printf("nInvalid choice...");void main() }{ }while(ch!=5); int ch,e; getch(); clrscr(); } do {
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL)//Is It first node? if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("nDo you want add Another(y/n)..."); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); } } } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL)//Is It first node? if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("nDo you want add Another(y/n)..."); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); } } } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL)//Is It first node? if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("nDo you want add Another(y/n)..."); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); New } } } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); 100 struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("nDo you want add Another(y/n)..."); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 New } } } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("nDo you want add Another(y/n)..."); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 New } } } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("nDo you want add Another(y/n)..."); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 New } } root } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); y { if(ch==y) s=t; create(t->right); create(root); 100 New } } root } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 New } } root } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = 100 New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = 100 New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = 100 New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ",t->data); if(c==l || c==L‘) scanf("%c",&c); l s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = 100 New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = 100 New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); 50 struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50 New{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50 New{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50 New{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50 New{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); y { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else 50{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else 50{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = 100 New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else 50{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = 100 New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else 50{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = 100 New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); r s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else 50{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = 100 New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else 50{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = 100 New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); 60 struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50 60 New{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50 60 New{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50 60 New{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50 60 New{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); n { if(ch==y) s=t; create(t->right); create(root); 100 root } } s } } else 50 60 New{ New=(struct node *) malloc (sizeof (struct node));
    • void create(struct node *t) t = NULL New->left=New->right=NULL;{ printf("nEnter the Element..."); char ch; scanf("%d",&New->data); struct node *s; if(root==NULL) if(t!=NULL) root=New; { else printf("nWhether you want to insert at { Left or Rigth( L/R) of %d ", t->data); if(c==l || c==L‘) scanf("%c",&c); s->left=New; if(c==l|| c==L‘) else { s->right=New; s=t; create(t->left); } } printf("Do you want add Another (y/n)"); else scanf("%c",&ch); { if(ch==y) s=t; create(t->right); create(root); 100 root } } } } else 50 60{ New=(struct node *) malloc (sizeof (struct node));
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) 0 { top = -1 finish = 0 p=stack[top]; top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p p=root; printf("nInorder Traversal is...n"); 50 60 do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top 0 NULL { finish = 0 p=stack[top]; top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p p=root; printf("nInorder Traversal is...n"); 50 60 do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 0 p=stack[top]; top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); p 50 60 do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } top1 100 if(top!=0) 0 NULL { finish = 0 p=stack[top]; top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); p 50 60 do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } top1 100 if(top!=0) 0 NULL { p=stack[top]; finish = 0 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; top2 50 } 1 100 if(top!=0) 0 NULL { finish = 0 p=stack[top]; top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; top2 50 } 1 100 if(top!=0) 0 NULL { finish = 0 p=stack[top]; top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; top2 50 } 1 100 if(top!=0) 0 NULL { finish = 0 p=stack[top]; top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); p 50 60 do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } top1 100 if(top!=0) 0 NULL { finish = 0 p=stack[top]; top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } top1 100 if(top!=0) 0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } top1 100 if(top!=0) 0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } top1 100 if(top!=0) 0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } top1 100 if(top!=0) 0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p p=root; printf("nInorder Traversal is...n"); 50 60 do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 p do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 p do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 p do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } top1 60 if(top!=0) 0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } top1 60 if(top!=0) 0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } top1 60 if(top!=0) 0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 p do { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 0 p=stack[top]; 50 100 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 0 p=stack[top]; 50 100 60 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 0 p=stack[top]; 50 100 60 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 0 p=stack[top]; 50 100 60 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 0 p=stack[top]; 50 100 60 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 1 p=stack[top]; 50 100 60 top--;
    • void in_order() printf("%d ",p->data);{ p=p->right; int finish=0; } if(root==NULL) else { finish=1; printf("nTree is Empty...");return; }while(finish==0); } } 100 root stack[++top]=NULL; p=root; printf("nInorder Traversal is...n"); 50 60 do p NULL { while(p!=NULL) { 4 stack[++top]=p; 3 p=p->left; 2 } 1 if(top!=0) top0 NULL { finish = 1 p=stack[top]; 50 100 60 top--;
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); 50 60 while(p!=NULL) { printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else 0 p=stack[top--]; top = -1 finish = 0 }}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p p=root; printf("nPreorder Traversal is...n"); 50 60 while(p!=NULL) { printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else top0 NULL p=stack[top--]; }}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p p=root; printf("nPreorder Traversal is...n"); 50 60 while(p!=NULL) { printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else top0 NULL p=stack[top--]; }}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p p=root; printf("nPreorder Traversal is...n"); 50 60 while(p!=NULL) { printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else top0 NULL p=stack[top--]; } 100}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p p=root; printf("nPreorder Traversal is...n"); 50 60 while(p!=NULL) { printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else top0 NULL p=stack[top--]; } 100}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p p=root; printf("nPreorder Traversal is...n"); 50 60 while(p!=NULL) { printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; top1 60 else 0 NULL p=stack[top--]; } 100}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p p=root; printf("nPreorder Traversal is...n"); 50 60 while(p!=NULL) { printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; top1 60 else 0 NULL p=stack[top--]; } 100}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); p 50 60 while(p!=NULL) { printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; top1 60 else 0 NULL p=stack[top--]; } 100}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); p 50 60while(p!=NULL){ printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; top1 60 else 0 NULL p=stack[top--]; } 100}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); p 50 60while(p!=NULL){ printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; top1 60 else 0 NULL p=stack[top--]; } 100 50}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); p 50 60while(p!=NULL){ printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; top1 60 else 0 NULL p=stack[top--]; } 100 50}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); 50 60 pwhile(p!=NULL){ printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else top0 NULL p=stack[top--]; } 100 50}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); 50 60 pwhile(p!=NULL){ printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else top0 NULL p=stack[top--]; } 100 50}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); 50 60 pwhile(p!=NULL){ printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else top0 NULL p=stack[top--]; } 100 50 60}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); 50 60 pwhile(p!=NULL){ printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else top0 NULL p=stack[top--]; } 100 50 60}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); 50 60while(p!=NULL) p NULL{ printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else 0 p=stack[top--]; top = -1 } 100 50 60}
    • void pre_order(){ if(root==NULL) { printf("nTree is Empty..."); return; } 100 root stack[++top]=NULL; p=root; printf("nPreorder Traversal is...n"); 50 60while(p!=NULL) p NULL{ printf("%d ",p->data); if(p->right!=NULL) 4 stack[++top]=p->right; 3 if(p->left!=NULL) 2 p=p->left; 1 else 0 p=stack[top--]; top = -1 } 100 50 60}
    • void post_order(){ int f; if(root==NULL) { printf("nTree is Empty..."); return; 100 root } stack[++top]=NULL; 50 60 p=root; printf("nPostorder Traversal is...n"); 4 4 3 3 2 2 1 1 0 0 top = -1
    • void post_order(){ int f; if(root==NULL) { printf("nTree is Empty..."); return; 100 root } p stack[++top]=NULL; 50 60 p=root; printf("nPostorder Traversal is...n"); 4 4 3 3 2 2 1 1 0 top 0 NULL
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } p stack[++top]=p->right; flag[top]=-1; 50 60 } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 while(f==1) 0 top 0 NULL { printf("%d ",p->data); f=flag[top];
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } p stack[++top]=p->right; flag[top]=-1; 50 60 } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 top 1 100 while(f==1) 0 0 NULL { printf("%d ",p->data); f=flag[top];
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } p stack[++top]=p->right; flag[top]= -1; 50 60 } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; -1 2 top 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { printf("%d ",p->data); f=flag[top];
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } stack[++top]=p->right; flag[top]= -1; p 50 60 } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; -1 2 top 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { printf("%d ",p->data); f=flag[top];
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } stack[++top]=p->right; flag[top]= -1; p 50 60 } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; -1 2 top 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { printf("%d ",p->data); f=flag[top];
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } stack[++top]=p->right; flag[top]= -1; p 50 60 } p=p->left; } if(top!=-1) 4 4 { 1 3 top 3 50 f=flag[top]; -1 2 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { printf("%d ",p->data); f=flag[top];
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 } p NULL p=p->left; } if(top!=-1) 4 4 { 1 3 top 3 50 f=flag[top]; -1 2 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { printf("%d ",p->data); f=flag[top];
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 } p NULL p=p->left; } if(top!=-1) 4 4 { 1 3 top 3 50 f=flag[top]; -1 2 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { printf("%d ",p->data); f=flag[top];
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 } p NULL p=p->left; } if(top!=-1) 4 4 { 1 3 top 3 50 f=flag[top]; -1 2 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { printf("%d ",p->data); f=flag[top];
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } stack[++top]=p->right; flag[top]= -1; p 50 60 } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; -1 2 top 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); f=flag[top];
    • do p=stack[top];{ top--; while(p!=NULL) } { if(f==-1) stack[++top]=p; f=1; flag[top]=1; } if(p->right!=NULL) }while(top!=-1); 100 root { } stack[++top]=p->right; flag[top]= -1; p 50 60 } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; -1 2 top 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 p } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 top 1 100 while(f==1) 0 0 NULL { f = -1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 p } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 top 1 100 while(f==1) 0 0 NULL { f = -1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 p } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 top 1 100 while(f==1) 0 0 NULL { f = -1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 p } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 top 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 p } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 top 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 p } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 top 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 p } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 1 2 top 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 } p NULL p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 1 2 top 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 } p NULL p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 1 2 top 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 } p NULL p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 1 2 top 2 60 p=stack[top--]; 1 1 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 p } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 top 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 p } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 top 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 p } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 top 1 100 while(f==1) 0 0 NULL { f=1 printf("%d ",p->data); 50 60 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } p stack[++top]=p->right; flag[top]= -1; 50 60 } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 while(f==1) 0 top 0 NULL { f=1 printf("%d ",p->data); 50 60 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } p stack[++top]=p->right; flag[top]= -1; 50 60 } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 while(f==1) 0 top 0 NULL { f=1 printf("%d ",p->data); 50 60 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } p stack[++top]=p->right; flag[top]= -1; 50 60 } p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 while(f==1) 0 top 0 NULL { f=1 printf("%d ",p->data); 50 60 100 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 } p NULL p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 while(f==1) 0 0 { top = -1 , f = garbage printf("%d ",p->data); 50 60 100 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 } p NULL p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 while(f==1) 0 0 { top = -1 , f = garbage printf("%d ",p->data); 50 60 100 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 } p NULL p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 while(f==1) 0 0 { top = -1 , f = garbage printf("%d ",p->data); 50 60 100 f=flag[top];
    • do p=stack[top--];{ } while(p!=NULL) if(f==-1) { f=1; stack[++top]=p; } flag[top]=1; }while(top!=-1); if(p->right!=NULL) 100 root { } stack[++top]=p->right; flag[top]= -1; 50 60 } p NULL p=p->left; } if(top!=-1) 4 4 { 3 3 f=flag[top]; 2 2 p=stack[top--]; 1 1 while(f==1) 0 0 { top = -1 , f = garbage printf("%d ",p->data); 50 60 100 f=flag[top];