Some classical algorithm here in C#