Exercise on sorting a collection