给定一个长度为M的数组(元素不重复),求出其给定大小为K的所有子集。
c语言程序如下:
算法:采用递归的思想(这个是从别人那里抄来的 (*^__^*) 嘻嘻……)
#include<stdio.h>
#include<malloc.h>
#define M 10
#define K 2
int count=0;//记录总共产生了多少个子集
void get_subsets(intarrays[], int *tem, intarrays_start, int tem_length){
int i=0;
if(tem_len