Articles that discuss various algorithms and data structures.
General Programming » Algorithms


Data Structures
Articles about algorithms with an emphasis on data structures.

Creating a Sparse Matrix in .NET
A sparse matrix is a data structure that acts like a two-dimensional array but uses far less memory. It is ideal for scenarios where you are maintaining a logical grid and most cells are empty.
By Jonathan Wood on Thursday, February 10, 2011

Evaluators and Interpreters
Articles relating to evaluators, interpreters and related topics.

A C# Expression Evaluator
This article presents C# code to evaluate mathematical expressions. Although I've seen some interesting techniques to accomplish this through various libraries and system calls, my approach was to simply write the code from scratch.
By Jonathan Wood on Sunday, December 26, 2010

Miscellaneous algorithm-related articles.

C# Payment Calculator
Here's a simple C# class that will calculate your monthly payment for a given loan.
By Jonathan Wood on Sunday, June 29, 2014

Obfuscated Swaps
Here's some tricks for swapping values between two variables in a way that makes it more difficult for a hacker debugging your program to understand.
By Jonathan Wood on Saturday, November 1, 2014

Text Algorithms
Articles that discuss various text-related algorithms.

Approximate String Comparisons Using Levenshtein Distance
Here's some code for testing the degree of similarity between two different strings. The Levenshtein distance algorithm returns the number of edit steps needed to make one string the same as the other.
By Jonathan Wood on Sunday, February 27, 2011

Fast Text Search with Boyer-Moore
This article describes the Boyer-Moore exact pattern matching algorithm, presents C# code that implements the algorithm, and then tells you why you probably should not use the code.
By Jonathan Wood on Sunday, February 6, 2011

Phonetic String Comparison with Soundex
This article describes the Soundex and Metaphone algorithms, which can be used to perform phonetic (sound-alike) comparisons of strings.
By Jonathan Wood on Friday, January 14, 2011