Revision: 65782
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 20, 2014 02:29 by dare10
Initial Code
#include <iostream> using namespace std; void Preorder(tree *T){ int t=T->root; cout << t << " "; if(T->P[t].dijete!=-1){ T->root = T->P[t].dijete; Preorder(T); } if(T->P[t].brat!=-1){ T->root = T->P[t].brat; Preorder(T); } } void Postorder(tree *T){ int t=T->root; if(T->P[t].dijete!=-1){ T->root = T->P[t].dijete; Postorder(T); } cout << t << " "; if(T->P[t].brat!=-1){ T->root = T->P[t].brat; Postorder(T); } } void Inorder(tree *T){ int t=T->root; if(T->P[t].dijete!=-1){ T->root = T->P[t].dijete; Inorder(T); } if(T->P[t].dijete==-1) cout << t << " "; int roditelj = ParentT(t,T); if(FirstChildT(roditelj,T)==t) cout << roditelj << " "; if(T->P[t].brat!=-1){ T->root = T->P[t].brat; Inorder(T); } }
Initial URL
Initial Description
Header datoteka u kojem se nalaze funkcije za Preorder Inorder i Postorder obilazak stabla
Initial Title
Preorder Inorder Postorder
Initial Tags
Initial Language
C++