exmple for algorithm