logic problems

    Date: 07/14/06 (Algorithms)    Keywords: programming

    (This question doesn't use any code, but I do think it's related to logic programming, so is included in this community.)

    Say you have sets of things, so that each set contains different elements and each set has n things.
    (1 2 3)
    (a b c)
    (x y z)

    How do you determine how many possible ways there are to arrange the items in the set?
    For instance, one way is:
    ( (1 a x) (2 b y) (3 c z))

    As it turns out, I've counted the number of arrangements for 3 sets that each have 3 items, and there are 36 of them. This went against my first instinct that there would be 27. But now I understand why there are 36 though: imagine you had 3 sets of 2 items each. There are 6 solutions to that problem. There are 6 ways to permute (1 2 3). And 6 * 6 = 36.

    I am wondering if there is a general formula for determining how many possibilities there are. For instance, if I have 4 sets of 6 items each, how many possible solutions are there? 7 sets of 5 elements each? And so on?

    The answer has computing implications, in that the magnitude of the answer needs to be taken into consideration when planning out a program I'm writing. Thanks for any help!

    Source: http://community.livejournal.com/algorithms/81789.html

« DFT || A Search for suitable... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home