C Code:
#include <stdlib.h>
#include <stdio.h>
#define MAXNODES 20 //Can be lowered or raised as desired
typedef int labeltype;
typedef int node;
typedef struct{
labeltype label;
node first_child, next_sibling;
} node_struct;
typedef struct{
node_struct space[MAXNODES];
node empty;
} prost;
node INITIALIZE(prost *pr){
int i;
for (i=0;i<MAXNODES-1;i++){
pr->space[i].next_sibling=i+1;
}
pr->space[MAXNODES-1].next_sibling=-1;
return 0;
}
node NEW_TREE(labeltype label, prost *pr){
node temp;
temp=pr->empty;
pr->empty=pr->space[pr->empty].next_sibling;
pr->space[temp].first_child=-1;
pr->space[temp].next_sibling=-1;
pr->space[temp].label=label;
return temp;
}
node FIRST_CHILD(labeltype label, node parent, prost *pr){
node temp;
temp=pr->empty;
pr->empty=pr->space[pr->empty].next_sibling;
pr->space[parent].first_child=temp;
pr->space[temp].first_child=-1;
pr->space[temp].next_sibling=-1;
pr->space[temp].label=label;
return temp;
}
node NEXT_BROTHER(labeltype label, node brother, prost *pr){
node temp;
temp=pr->empty;
pr->empty=pr->space[pr->empty].next_sibling;
pr->space[brother].next_sibling=temp;
pr->space[temp].first_child=-1;
pr->space[temp].next_sibling=-1;
pr->space[temp].label=label;
}
int main(void){
// ????????
system("pause");
return 0;
}
The bad thing is it doesn't contain Main Function (is empty) but the functions are correctly written and can be used. I just needed several minutes to name the variables on the international level (Trust me, you don't wanna read Croatian code

). I'm not sure if this is going to help, but last 2-3 weeks I'm trying by modifying this code.
