With Lemma 6, ROTATED SORT can be done in
n
i=1(2l
i
1+ 1
l ) operations; we know that to minimize the
sorting cost, l should be chosen to minimize 2
ln
1
l . We can
always choose the perfect l but make the cost amortized,
by performing normalization that takes O(n) operations
whenever the array grows until l is not optimal. A perfectly
sorted array can be visualized as an l-levels rotated
list, regardless of l.