Revision: 68532
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 19, 2015 08:40 by brumihali
Initial Code
void Preorder(tr *T){ int pom = RootT(T); cout << pom << " "; if(FirstChildT(pom, T) != -1){ T->prvi = FirstChildT(pom, T); Preorder(T); } if(NextSiblingT(pom, T) != -1){ T->prvi = NextSiblingT(pom, T); Preorder(T); } } void Inorder(int t,tr *T){ if (FirstChildT(t,T)!=-1) Inorder(FirstChildT(t,T),T); cout <<t<<" "; if(FirstChildT(t,T)!=-1){ t=FirstChildT(t,T); while(NextSiblingT(t,T)!=-1){ t=NextSiblingT(t,T); Inorder(t,T); } } } void Postorder(tr *T){ int pom = RootT(T); if(FirstChildT(pom, T) != -1){ T->prvi = FirstChildT(pom, T); Postorder(T); } cout << pom << " "; if(NextSiblingT(pom, T) != -1){ T->prvi = NextSiblingT(pom, T); Postorder(T); } }
Initial URL
Initial Description
Ophodnja stabla (preorder, inorder, postorder)
Initial Title
Ophodnja_stabla.h
Initial Tags
Initial Language
C++