n different objects in p containers

Discussion in 'C Programming' started by mghorba, Oct 28, 2014.

?

n different objects in p containers

  1. pseudo code

    0 vote(s)
    0.0%
  2. code

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. mghorba

    mghorba

    Joined:
    Oct 28, 2014
    Messages:
    2
    Likes Received:
    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.
     
    mghorba, Oct 28, 2014
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Koen
    Replies:
    1
    Views:
    642
  2. Claudio Jolowicz

    unique objects and stl containers

    Claudio Jolowicz, Apr 9, 2004, in forum: C++
    Replies:
    11
    Views:
    2,414
    James Dennett
    Apr 10, 2004
  3. JackC
    Replies:
    3
    Views:
    823
    Alan Griffiths
    Aug 13, 2004
  4. ALiX
    Replies:
    8
    Views:
    408
  5. utab
    Replies:
    3
    Views:
    352
    benben
    Mar 2, 2006
  6. 7stud
    Replies:
    11
    Views:
    1,123
    Dennis Lee Bieber
    Mar 20, 2007
  7. clark.coleman@att.net
    Replies:
    7
    Views:
    851
    Pete Becker
    Jan 25, 2008
  8. Sebastian Mach
    Replies:
    5
    Views:
    522
    mach.seb@googlemail.com
    Oct 6, 2012
Loading...