Ask your own question, for FREE!
Mathematics 20 Online
ganeshie8 (ganeshie8):

how does this powerset function work ``` function power_set(set) { var power_set=[]; for(i=0; i<(1<

ganeshie8 (ganeshie8):

Haha i don't like javascript either as my fav is perl

OpenStudy (nincompoop):

I think the result is pretty good, I just never liked Js because it always looks cluttered. power set is to provide all the subsets of a set. recursive and non-recursive

OpenStudy (nincompoop):

P {a, b, c} {} {a} {b} {c} {a,b} ... and so on and so forth http://rosettacode.org/wiki/Power_Set#JavaScript

ganeshie8 (ganeshie8):

wow that looks more compact! im still trying to figure out get how it works

OpenStudy (nincompoop):

ganeshie8 (ganeshie8):

looks the python powerset function is also using the leftshift and the logical and

OpenStudy (nincompoop):

https://wiki.python.org/moin/BitManipulation

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!