Revision: 39175
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 14, 2011 05:30 by majugurci
Initial Code
struct elem { char label; int firstchild, nextsibling; }; struct tr { elem elements [10000]; int first; }; int ParentT (int n, tr *tree) { if (n==0) return -1; else return a-1; } int FirstChildT (int n, tr *tree) { if (n>=0) return tree->elements[n].firstchild; else return -1; } int NextSiblingT (int n, tr *tree) { if (tree->elements[n].nextsibling!=-1) return tree->elements[n].nextsibling; else return -1; } int LabelT (int n, tr *tree) { return tree->elements[n].label; } int RootT (tr *tree) { return tree->elements[0].label; } int CreateT (int x, int n, tr *tree) { tree->elements[tree->first].label=x; tree->elements[tree->first].firstchild=n; tree->first++; } int ChangeLabelT (int x, int n, tr *tree) { tree->elements[n].label=x; } int DeleteT (int n, tr *tree) { if (tree->elements[n].firstchild>0) DeleteT (tree->elements[n].firstchild, tree); else { tree->elements[n].label=-1; tree->first--; } } tr *InitT (int x, tr *tree) { delete[]tree->elements; tree = new tr; tree->first=0; tree->elements[x].label=x; tree->first++; }
Initial URL
Initial Description
Initial Title
opcenito stablo
Initial Tags
Initial Language
C++