Tag Archives: selections

Linkback to the Secret Santa Problem

Tom left a comment to my post Calculate the number of secret Santa permutations in C#. He used that example to build a site in JavaScript explaining how the algorithm works. It’s a pretty cool little page. Drop by and … Continue reading

Posted in algorithms, combinatorics, mathematics | Tagged , , , , , , , , , , , , , | Leave a comment

Use a tristate CheckBox to show partial selections in C#

The example Use a tristate CheckBox in C# explains how to let the user click a tristate CheckBox. This example demonstrates a particularly common usage: allowing the user to select some, all, or none of a set of other options. … Continue reading

Posted in controls | Tagged , , , , , , , , , , , | Leave a comment

Send secret Santa emails in C#

This example shows how you can automatically send secret Santa emails for a party. The example Pick a secret Santa assignment in C# shows how you can quickly make secret Santa assignments. The post Calculate the number of secret Santa … Continue reading

Posted in algorithms, combinatorics, mathematics | Tagged , , , , , , , , , , , , , | Leave a comment

Calculate the number of secret Santa permutations in C#

The example Pick a secret Santa assignment in C# picks a valid permutation of the people so no one is mapped to himself or herself. Such a permutation is called a derangement. See that example for details. The number of … Continue reading

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

Pick a secret Santa assignment in C#

In a secret Santa party, you put everyone’s names in a hat and people draw from the hat. Each person becomes the secret Santa for the person he draws and gets that person a present for the party. To keep … Continue reading

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

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