Algorithms in C implementation