Talk:Power set: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
No edit summary
Line 2: Line 2:


This is what your Ada code gives:
This is what your Ada code gives:
A
* A
C
* C
E
* E
A
* A
A,C
* A,C
A,E
* A,E
A,C
* A,C

Revision as of 16:08, 14 October 2008

So how about the slow approach of coming up with random combinations and adding them to a set until it has 2n elements? The set object would have to guarantee uniqueness, but it would work eventually. To save some time you could add each element in the original list and the empty set to start then add sets of size 2 to n. --Mwn3d 10:59, 16 June 2008 (MDT)

This is what your Ada code gives:

  • A
  • C
  • E
  • A
  • A,C
  • A,E
  • A,C