In-Place Permutation Sorting

Puzzle: Array A contains elements whose keys are a permutation of the numbers zero through n-1. How fast can we sort A using swaps?

Well, O(n2) and $O(n\log n)$ ought to be easy, yes?

Can we do better?

5 3 0 4 6 2 7 1 9 8


next up previous
Next: An Algorithm Up: POTENTIAL FUNCTION ANALYSIS Previous: Motivation