Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>These are some considerations about finding all combinations:</p> <p>First find all combinations to achive the larger of the two categories (A or B) by 1 or 2 items; it shall be easy to calculate the possible amounts of 1s and 2s and then to enumerate their positions (combinations <strong>I</strong>).</p> <p>10 = 2+2+2+2+2 or 1+1+1+1+1+1+1+1+1+1 or 2+2+2+1+1+1+1</p> <p>Then you can add the other categorie's amount. Each set of 2 is already full, each set of 1 may or may not get another one attached. Having all such combinations <strong>II</strong> (2 for each set of 1), you can calculate how many of the smaller category are missing. Eliminate such combinations <strong>II</strong> that include too many of the second category.</p> <p>Finally the amount of missing items in each combination <em>II</em> must be filled up - using 0/1 or 0/2 sets. This is the same problem as above. Due to smaller amounts, caching may increase performance here. So for each combination <strong>II</strong> you enumerate by the combinations for the missing items and finally have the combinations <em>III</em> you were looking for.</p> <p>Together:</p> <ol> <li>Possible amounts of 1 (1/0) and 2 (2/0)-sets to achive the larger categorie's (e.g. A's) amount I. Systematic shuffling of the 1/0s and 2/0s II. Two possible combinations for each 1/0 -> 1/0 or 1/1 - and elimination of impossible combinations II III. Possible combinations for the missing amount of (e.g.) B's like in I</li> </ol> <p>However, solving puzzles has not a lot to do with PHP. And regarding performance it depends a lot on the system on the amounts. Caching may increase performance for some combinations and decrease for others. And of course the algorith suggestes above has a lot of room for optimizations.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload