Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Recursion problem (Power set)

by lodin (Hermit)
on May 25, 2008 at 11:02 UTC ( [id://688394]=note: print w/replies, xml ) Need Help??


in reply to Recursion problem

This problem can be expressed mathematically as

s = { sum(y) = n | y in P(x) }
where x is the bag (list) of elements, n is the number the elements in the bag should sum up to, P is the "power bag" operator, and s is the set of solutions. (Bags allow duplicate elements, in sets all elements are unique.)

That is, all you need to figure out is how to write a "power bag" function, and luckily for you several people have done that already. Try searching CPAN for "power set" for Perl versions.

lodin

Replies are listed 'Best First'.
Re^2: Recursion problem (Power set)
by Anonymous Monk on May 25, 2008 at 11:26 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://688394]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-26 07:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found