Tag Archives: factorial

Generate all selections of K items from a set of N items in C#

This example is somewhat similar to Generate all of the permutations of a set of objects in C#. The basic idea is to use a recursive method to assign the next item to the combination. The first call to the … Continue reading

Posted in algorithms, combinatorics, mathematics | Tagged , , , , , , , , , , , , , , , | 3 Comments

Calculate the binomial coefficient “N choose K” efficiently in C#

The binomial coefficient, written and pronounced “n choose k,” is the number of ways you can pick k items from a set of n items. For example, suppose you have a deck of 5 cards (n = 5) and you … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , , , , | 9 Comments