. void myFunction(long k, SetElem *pAElems,pFamilyOfSet pFamSetA,pSet pB) {
SetElem *a=pAElems;
long i=k;
pB=createNullSet();
while(*a!='\n')
{
if(i%2==1)
//表示二进制最后一位是1
directInsertSetElem(pB,*a);
a++;
i>>=1;
}
insertToFamilyOfSet(pFamSetA,pB);
//把集合加入到集族
k--;
if(k>=0)
//2~n-1个子集
myFunction(k,pAElems,pFamSetA,pB); } pFamilyOfSet PowerSet(pSet pA) {
//Add your code here
pFamilyOfSet pFamSetA=createNullFamilyOfSet();
long i,k=1;
//设置循环变量
SetElem *pAElems=outToBuffer(pA);
pSet pB=createNullSet();
for(i=0;*(pAElems+i)!='\n';)
i++;
k<<=i ;
myFunction(k,pAElems,pFamSetA,pB);
return pFamSetA; }