Saturday, July 5, 2014

What is the most efficient way to generate all the multiset, combinations, probability, dispositions and permutations of an array in PHP?

What is the most efficient way to generate all the multiset, combinations, probability, dispositions and permutations of an array in PHP?

Here is code to get all permutations:

http://www.php.net/manual/en/function.shuffle.php#90615

With the code to get the power set, permutations are those of maximal length, the power set should be all combinations. I have no idea what dispositions are, so if you can explain them, that would help.

You can use this class: http://pear.php.net/package/Math_Combinatorics

combination with repetitions
統計學
組合排列

http://en.wikipedia.org/wiki/All-pairs_testing
http://rosettacode.org/wiki/Combinations_with_repetitions
http://en.wikipedia.org/wiki/Multiset
http://en.wikipedia.org/wiki/Probability
http://en.wikipedia.org/wiki/Combination
http://en.wikipedia.org/wiki/Permutations

No comments: