Sort exercise from Ch. 10 of Chris Pine's "Learning to Program"