Algorithms in C and CPP