C++로 구현한 부분집합 구하기
int Value[MAX_DEPTH];
void BinaryTree(int initDepth, int depth) {
if(initDepth == depth) {
printf("{");
for(int i=0; i<=depth; i++)
if(Value[depth-i] == 1) printf(" %d ", i);
printf("}\n");
return ;
}
Value[initDepth] = 0;
BinaryTree(initDepth + 1, depth);
Value[initDepth] = 1;
BinaryTree(initDepth + 1, depth);
}