parcurgere arbore binar

Sa se parcurga un arbore binar   #include<iostream.h>#include<conio.h>struct nod{int nr;nod* st,*dr;};nod *c;int nrst,nrdr;void svd(nod *c){if(c){svd(c->st);cout<<c->nr;svd(c->dr);}}void vsd(nod *c){if(c){cout<<c->nr;vsd(c->st);vsd(c->dr);}}void sdv(nod *c){if(c){sdv(c->st);sdv(c->dr);cout<<c->nr;}}nod *arb(){int n;nod *c;cout<<"n=";cin>>n;if(n){c=new nod;c->nr=n;c->st=arb();c->dr=arb();return c;}else return 0;}void main(){clrscr();c=arb();svd(c);cout<<endl;vsd(c);cout<<endl;sdv(c);cout<<endl;getch();}

Continue Readingparcurgere arbore binar