Implementation of various algorithms in c#