C, C++, C# and MATLAB Expert

Joined
Oct 28, 2014
Messages
2
Reaction score
0
I am trying to write a code that lists all possible assignments of say n objects in p containers.

For instance, if N={a,b} is the containers set and S={1,2} is the objects, then I want to have:

{ ( {1,2} , { } ) ; ( {1} , {2} ) ; ( {2} , {1} ) ; ( { } , {1,2} ) } where the tuple elements are respectively assignments to objects a and b from N.

This grows rapidly in fact for N containers and S objects, there are N^S possibilities which I want the program to list.

How you ever encountered any code, pseudo code, or algorithm that would list all the possibilities?

Thanks a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top