Simple algorithms in C#.