//$ <test executable> <input file containing sequence s> <input alphabet file> int main(int argc, char* argv[]) { seqlength=loadseq(argv[1]); printf("seqlength %d \n", seqlength); nalpha=loadalpha(argv[2]); printf("nalpha %d \n",nalpha); buildTree(); //// top results pid_t pid=getpid(); printf("pid %d\n", pid); sprintf(topcommand, "top -b -n 1 -p %d >%s.top ", pid , argv[1]); system(topcommand); /////post -order print potdepths=malloc(internalID*sizeof(int)); memset(potdepths, 0, internalID*sizeof(int)); printf("\n\n++++++++++++++++\n"); printTree(root); // post-order, find max depth here printf("post-order traversal depths\n"); printDepth(potdepths); /////// DFS print d=0; dfsdepths=malloc(internalID*sizeof(int)); memset(dfsdepths, 0, internalID*sizeof(int)); printf("\n\n++++++++++++++++\n"); DFS(root); // post-order printf("DFS depths\n"); printDepth(dfsdepths); // longest exact matching printf("\n\n++++++++++++++++\n"); printf("avg internal depth: %d, max internal depth: %d\n", sumdepth/(internalID-seqlength),maxdepth ); int i =0; while(maxnodes[i]) { printf("longest exact matching sequence is at node %d :\n", maxnodes[i]->id); printLongest(maxnodes[i]); printf("for suffix :\n"); printChildren(maxnodes[i]); i++; printf("\n"); } }
int main() { int l[] = {0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15}; printLongest(l, 16); }