class Object

Public Instance Methods

powerset(arr) click to toggle source
# File lib/sravan.rb, line 1
def powerset arr
        a = [[]]
        for num in arr
                size_a = a.size; j = 0;
                while j < size_a
                        a << (a[j] + [num])
                        j+=1
                end
        end
        a
end