Challenge 224: Sort it out!
A challenge about sorting numbers into ascending order.
a Your task is to sort the following list of numbers into increasing order, using a particular kind of “move”.
14, 22, 19, 5, 28, 7
Each “move” consists of taking one number out of the list and placing it at the right-hand end of the list. For example, the first move could be
14, 22, 5, 28, 7, 19
where the 19 has been removed from between the 22 and the 5 and placed at the right-hand end, after the 7.
Show that you cannot sort the list in three (or fewer) moves.
b Now your task is to sort another list of numbers into increasing order. Once again each “move” consists of taking one number out of the list and placing it at the right-hand end of the list.
Describe a strategy for sorting the list in the minimum number of moves and give a way of seeing how many moves will be needed in this case. How do you know your method will definitely give the minimum number of moves?