#include #include #include int main ( int argc, char *argv[] ) { int n, *PERM, *P, i, j, t; int nextchild, nextparent, remaining; FILE *fp; n = (argc == 1) ? 25 : atoi(argv[1]); srand((unsigned int)time(NULL)); PERM = (int *)malloc(n * sizeof(int)); for (i=0; i 0) { if (remaining > 5) t = (nextchild == nextparent) ? 1 + rand() % 5 : rand() % 5; else t = (nextchild == nextparent) ? 1 + rand() % remaining : rand() % remaining; remaining -= t; for (i=0; i