3 ms·
Nitpick: \rho = n/2 in the worst case, if n > 1, but that still gives you O(n log n).
by pmiller2 8y ago
Nitpick: \rho = n/2 in the worst case, if n > 1, but that still gives you O(n log n).
- Fri31Aug 8y agoWhy n/2? If the array is, for example, sorted in the reverse order, then there is no monotonous run at all, in which case I believe the algorithm considers each element from the array being a run in itself, giving n runs.