Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Randomization of the pivots produces O(n log n) average running time with a very low probability of any other running time for any value of n where the worst case running time matters.


Even without randomization of pivots expected run time is O(n log n). If the order of the input data is random, I don't believe randomizing pivots changes the distribution of running times.

What changes is that one very common permutation of data (ascending data) does not have O(n * 2) performance.


There's little justification for expecting data to behave randomly unless our algorithm introduces it.


Correct. In general, real data will seldom, if ever, look like random data.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: