[Edu-sig] re: Algorithm help Subsets

Kirby Urner urnerk@qwest.net
Sun, 03 Mar 2002 07:52:15 -0800


Note:

If you want your subsets to be unique, but your
inputs aren't, you'd need to make modifications
e.g.

   >>> subsets([2,2,2],2)
   [[2, 2], [2, 2], [2, 2]]
   >>> subsets([2,2,1],2)
   [[2, 2], [2, 1], [2, 1]]

This algorithm works best when the input sequence
contains unique elements.

Kirby