Who has written this qoute. If there isnt some sorting logic in swapping nothing get sorted. Somewhere must be checked whether to swap some elements.
There a lot of
Sorting algorithm out there.
Your qoute sounds a bit like quicksort. Very mysterous and not solvable...