예제 #1
0
파일: utils.cpp 프로젝트: D4De/caliper
int MBnext_k_permutation(int *ar, int n, int k) {
    int result = MBnext_permutation(ar, k);
    if (result == 0) {
        result = MBnext_combination(ar, n, k);
    }
    return result;
}
예제 #2
0
int main(void)
{
	unsigned int numbers[] = {0, 1, 2, 3};
	const size_t n = sizeof(numbers) / sizeof(unsigned int);
	
	do {
		MBprint_array(numbers, n, stdout);
		putchar('\n');
	} while (MBnext_permutation(numbers, n));

	return 0;
}
예제 #3
0
int main(void)
{
	unsigned int numbers[] = {0, 1, 2, 3};
	char *elements[] = {"a", "b", "c", "d"};
	const size_t n = sizeof(numbers) / sizeof(unsigned int);
	
	do {
		MBprint_set(numbers, n, (void*)elements, "[]", (MBprintfn)fputs, stdout);
		putchar('\n');
	} while (MBnext_permutation(numbers, n));

	return 0;
}