few algorithms implemented in c