コード例 #1
0
        public              Zbior[] Podzbiory()
        {
            Zbior[] podzbiory = new Zbior[(int)Math.Pow(2, this.Ile)];
            int     i         = 0;

            Zbior.PodzbioryRek(this, new Zbior(), podzbiory, ref i);
            //return Zbior.getSubsets(this);
            return(podzbiory);
        }
コード例 #2
0
 private static void PodzbioryRek(Zbior z1, Zbior z2, Zbior[] tab, ref int i)
 {
     for (int j = 0; j < 63; j++)
     {
         if (z1[j])
         {
             z1[j]    = false;
             z2[j]    = true;
             tab[i++] = z2;
             Zbior.PodzbioryRek(z1, z2, tab, ref i);
             z2[j] = false;
         }
     }
 }