WEB Programming concepts for array variations/combinatoins.

Discussion in 'OT Technology' started by rodman8600, Jan 30, 2009.

  1. rodman8600

    rodman8600 OT Supporter

    Joined:
    Sep 6, 2003
    Messages:
    13,542
    Likes Received:
    6
    Location:
    South Bay, CA
    The language isn't a concern here, I'm trying to figure out how to go about this logically.

    Let say I have an array:

    [A] [C] [D] [E]...etc..etc.. with top limits.

    How would you go about finding all variations of this array provided all of the arrays stay in order. ie:

    [A] [C] [D]
    [A] [C]
    [A]
    [A] [C] [D] [E]
    [A] [D] [E]
    [A] [E]
    [A] [E]
    [A] [D] [E]
    [A] [C] [D] [E]
    etc. etc.

    Like I said I'm not looking for programming examples, just concepts on how to go about this.
     
  2. Potski

    Potski what?

    Joined:
    Feb 12, 2006
    Messages:
    15,354
    Likes Received:
    0
    Location:
    Angleterre
    Set case [A] (only one entry in the array) equal to 1

    The rest can be calculated from the number (n) of entries in the array by the equation: 2*(n-1)^2 - 2*(n-1) + 3
     

Share This Page