Implementing algorithms for fun in C#