void partitionOdd(int value) { printf("partitionOdd %d\n", value); int * buffer = malloc( value * sizeof(int)); partition_odd(buffer, 0, value); free(buffer); }
void partitionOdd(int value) { int * arr; printf("partitionOdd %d\n", value); arr = malloc(sizeof(int) * value); partition_odd(arr, 0, value); free (arr); }
void partition_odd(int * arr, int pos, int n) { if(n == 0) { print_arr(arr, pos); return; } int i; for(i = 1; i<= n; i++) { if(i % 2 != 1) { continue; } arr[pos] = i; partition_odd(arr, pos+1, n-i); } }
void partition_odd(int * arr, int index, int n) { int test; if (n == 0) { printf("= "); printpartition(arr, index); return; } else { for (test = 1; test <= n; test += 2) { arr[index] = test; partition_odd(arr, index + 1, n - test); } } }