Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Recursion problem (Power set)

by lodin (Hermit)
on May 25, 2008 at 11:02 UTC ( #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? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2022-01-24 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (65 votes). Check out past polls.

    Notices?