Problem:
A tourist is learning an incorrect way to sort a permutation of the integers . We define a fix on two adjacent elements and , to be an operation which swaps the two elements if , and does nothing otherwise. The tourist performs rounds of fixes, numbered . In round of fixes, the tourist fixes and , then and , and so on, up to and . In this process, there are total fixes performed. How many permutations of can the tourist start with to obtain after performing these steps?
, 2018
Solution
Solution:
Note that the given algorithm is very similar to the well-known Bubble Sort algorithm for sorting an array. The exception is that in the -th round through the array, the first pairs are not checked.
We claim a necessary and sufficient condition for the array to be sorted after the tourist's process is: for all , after rounds, the numbers are in the correct position. Firstly, this is necessary because these indices of the array are not touched in future rounds - so if a number was incorrect, then it would stay incorrect. On the other hand, suppose this condition holds. Then, we can "add" the additional fixes during each round (of the first pairs during the -th round) to make the process identical to bubble sort. The tourist's final result won't change because by our assumption these swaps won't do anything. However, this process is now identical to bubble sort, so the resulting array will be sorted. Thus, our condition is sufficient.
Now, there are two positions the can be in . There are three positions the can be in except for the position of . Similarly, for there are positions can be in, and after that the remaining numbers can be arranged arbitrarily. Thus, the answer is .