Cognitive Mileage

Algorithm for Getting the Power Set of a List

Posted on: May 13, 2008

This algorithm returns a list that is a power set of the inputted list. The code for int2bin is from DaniWeb‘s Python community.

So the module would give the following output:

>>> PowerSet([1,2,3])
[[3], [2], [2, 3], [1], [1, 3], [1, 2], [1, 2, 3]]
Advertisements

2 Responses to "Algorithm for Getting the Power Set of a List"

Wait, that’s not the Powerset I was looking for =)

{mark} powerset product manager

😀 sorry Mark 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: