code of various kinds of algorithm