Tag Archives: combinatorics

Book Errata Page: The C# Helper Top 100

This is the errata page for my book The C# Helper Top 100, The 100 most popular posts at csharphelper.com. If you find mistakes, please post them here in the Leave a Reply box at the bottom of the page. … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Book Discussion Page: The C# Helper Top 100

This is a discussion page for my book The C# Helper Top 100, The 100 most popular posts at csharphelper.com. Please post questions, thoughts, and suggestions here in the “Leave a Reply” box at the bottom of the page. I … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Table of Contents: The C# Helper Top 100

This is a brief summary of the book’s table of contents. Introduction Part I. Serialization 1. Read a CSV File into an Array (1) 2. Use JSON to Serialize and Deserialize Objects (49) Part II. Graphing 3. Draw a Graph … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

New Book: The C# Helper Top 100

I’m happy to announce my latest book, The C# Helper Top 100, The 100 most popular posts at csharphelper.com. It describes the 100 most popular posts on the C# Helper web site. This is my 32nd book and my second … Continue reading

Posted in .NET, algorithms, books, C#, C# programming | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Generate words of a given length in C#

The example Generate three-letter words in C# uses three nested for loops to generate words that contain three letters. This example uses the following code to generate words of any given length. // Generate words with num_letters letters. private List … Continue reading

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

Generate three-letter words in C#

This example uses the following very simple code to generate three-letter words using the letters a through z. // Make the items. private void Form1_Load(object sender, EventArgs e) { List<string> values = new List<string>(); for (char ch1 = ‘a’; ch1 … Continue reading

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

Enumerate pairs of objects in arrays or IEnumerables in C#

Sometimes it’s useful to enumerate pairs of objects in an array or enumerable. For example, if you have an array holding volleyball teams, the pairs would list each of the possible matches you could make. If the teams are A, … Continue reading

Posted in arrays, combinatorics, extension methods | Tagged , , , , , , , , , , , , , | Leave a comment

Select N random items from an array in C#

This example builds a generic extension method that lets you easily select N random objects from an array. For example, it lets you select 5 items from an array holding 10 names. Picking one random item from an array is … Continue reading

Posted in algorithms, arrays, mathematics, variables | 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 , , , , , , , , , , , , | 1 Comment