--- from: http://rosettacode.org/wiki/Move-to-front_algorithm