some algorithm in c