Revision: 65707
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 12, 2014 13:10 by AOT_code
Initial Code
void PreOrder(tree* T){ int node = T->root; cout << node << " "; if(T->array[node].firstchild != -1){ T->root = T->array[node].firstchild; PreOrder(T); } if(T->array[node].nextsibling != -1){ T->root = T->array[node].nextsibling; PreOrder(T); } } void InOrder(tree* T){ int node = T->root; if(T->array[node].firstchild != -1){ T->root = T->array[node].firstchild; InOrder(T); } int parent = ParentT(node, T); if(T->array[node].firstchild == -1) cout << node << " "; if(FirstChildT(parent, T) == node) cout << parent << " "; if(T->array[node].nextsibling != -1){ T->root = T->array[node].nextsibling; InOrder(T); } } void PostOrder(tree* T){ int node = T->root; if(T->array[node].firstchild != -1){ T->root = T->array[node].firstchild; PostOrder(T); } cout << node << " "; if(T->array[node].nextsibling != -1){ T->root = T->array[node].nextsibling; PostOrder(T); } }
Initial URL
Initial Description
Ophodnje korištene za općenito stablo (Pre,In,Postorder).
Initial Title
ophodnja_stabla.h
Initial Tags
Initial Language
C++