Performance of rearrange
n additional memory locations (for array u)
Assume we count object assignments only.
Overall time for sorting by ranking and rearranging must be expressed with a unit that is the same for each piece. So now let’s consider both comparisons and assignments:
Sorting time = n * (n - 1)/2 Comp + 2 * n Assign.