my exercise to learn algorithms