Sort Wizard

Chris has a boring assignment, which is to sort the following numbers:

\[85, 36, 49, 12, 57, 55, 79, 19, 60\]

Agnishom went by and saw Chris is bored. A sorting wizard he is, he tells Chris that:

If you sort the first two third, then sort the last two third, and then sort the first two third again, the entire list of numbers will be sorted!

Curious, Chris tried it out

  • sort the first two third : \(12, 36, 49, 55, 57, 85, 79, 19, 60\)
  • sort the last two third : \(12, 36, 49, 19, 55, 57, 60, 79, 85\)
  • sort the first two third : \(12, 19, 36, 49, 55, 57, 60, 79, 85\)

It really sorts the entire list! Does this work for any list of length divisible by 3? Or is this just a coincidence?

×

Problem Loading...

Note Loading...

Set Loading...