# Posted By

igotepava on 01/18/15

# Statistics

Viewed 633 times
Favorited by 0 user(s)

# ophodnja_stabla.h

/ Published in: C++
Save to your folder(s)

Implementacija ophodnje stabla: Inorder, Postorder, Preorder.

Copy this code and paste it in your HTML
`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);	}}`