some algorithms by c