/* * Please fill the functions in this file. * You can add additional functions. * * Hint: * You can write additonal functions. * * You may create additional arrays if needed. The maximum size * needed is specified by MAXLENGTH in pa01.h. */ #include "pa01.h" #include #include /* * ================================================================= * This function prints all partitions of a positive integer value * See the file "expected/expected_unsorted" for the output specification */ void partitionAll(int value) { printf("partitionAll %d\n", value); } /* * ================================================================= * This function prints the partitions that use increasing values. * * For example, if value is 5 * 2 + 3 and * 1 + 4 are valid partitions * * 5 is a valid partition * * 1 + 1 + 3 and * 2 + 1 + 2 and * 3 + 2 are invalid partitions. * * The program should generate only valid partitions. Do not * generates invalid partitions and checks validity before printing. * */ void partitionIncreasing(int value) { printf("partitionIncreasing %d\n", value); } /* * ================================================================= * This function prints the partitions that use unique values. * * For example, if value is 5 * 2 + 3 and * 3 + 2 and * 1 + 4 are valid partitions * * 5 is a valid partition * * 1 + 1 + 3 and * 2 + 1 + 2 are invalid partitions. * * The program should generate only valid partitions. Do not * generates invalid partitions and checks validity before printing. * */ void partitionUnique(int value) { printf("partitionUnique %d\n", value); } /* * ================================================================= */ void permute(char * charset, int len) { printf("permute %d\n", len); }