C# classic algorithm set