Revision: 68422
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 18, 2015 06:45 by igotepava
Initial Code
void Preorder(tr *T){ int pom = RootT(T); cout << pom << " "; if(FirstChildT(pom, T) != -1){ T->first = FirstChildT(pom, T); Preorder(T); } if(NextSiblingT(pom, T) != -1){ T->first = NextSiblingT(pom, T); Preorder(T); } } void Inorder(tr *T){ int pom = RootT(T); if(FirstChildT(pom, T) != -1){ T->first = FirstChildT(pom, T); Inorder(T); } int rod = ParentT(pom, T); if(FirstChildT(pom, T) == -1) cout << pom << " "; if(FirstChildT(rod, T) == pom) cout << rod << " "; if(NextSiblingT(pom, T) != -1){ T->first = NextSiblingT(pom, T); Inorder(T); } } void Postorder(tr *T){ int pom = RootT(T); if(FirstChildT(pom, T) != -1){ T->first = FirstChildT(pom, T); Postorder(T); } cout << pom << " "; if(NextSiblingT(pom, T) != -1){ T->first = NextSiblingT(pom, T); Postorder(T); } }
Initial URL
Initial Description
Implementacija ophodnje stabla: Inorder, Postorder, Preorder.
Initial Title
ophodnja_stabla.h
Initial Tags
data
Initial Language
C++