Algorithms

Data StructuresArticles about algorithms with an emphasis on data structures.

Creating a Sparse Matrix in .NETA 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 InterpretersArticles relating to evaluators, interpreters and related topics.

A C# Expression EvaluatorThis 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

GeneralMiscellaneous algorithm-related articles.

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

Obfuscated SwapsHere'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 AlgorithmsArticles that discuss various text-related algorithms.

Approximate String Comparisons Using Levenshtein DistanceHere'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-MooreThis 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 SoundexThis 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