King Arthur has a shelf with $10$ books, numbered $1,2,3,\dots,10$. Over the years, the volumes got disordered. Arthur tries to order the books in the increasing order by exchanging positions of two books at once. Since the books are heavy, he can only switch two volumes each day. Help Merlin to order the books.
E.g., If a permutation is $10, 9, 8, 7, 6, 5, 4, 3, 2, 1$ then we need just 5 switches to sort it in ascending order
Note: in the worst case there will be $9$ switches.
Find the permutation corresponding to the worst case
How to find the minimum number of switches required for a given permutation. (Algorithm & if possible code in either of C, C++, python)