common used algorithms and some exercise