Quicksort (n = 500)
Top Comments
All Comments (20)
-
@rolfsaurusa What? How do you find the median of an unsorted list of numbers without sorting it?
-
its quick, but the hungarian dance one is much funnier.)
-
@teeds88 fuck you
-
@spechtbert what? a random number generator is not deterministic. the degree of randomness of those can be subject of discussion, true, but they are sufficient for the best performance pivot. and if you believe truly random events don't exist, you're wrong.
-
@teeds88 threre is no random pivot, the choice is always deterministic.
-
random pivot has the best run time.
now, do this threaded! ;)
-
@Z4KJ0N3S little schoolboys and girl just exchange links these days, not minding the content.
-
@dachevashe true. Although I still think I responded to what he meant, you are technically correct.
-
@rolfsaurusa You're not correct neither. It can very well just select x[(l + r)/2] as a pivot, as the initial array is permuted randomly, this is essentially a random pivot. bhexric was not saying about median, but about x[(l+r)/2] rather, where l and r are left and right boundaries of subarray.
defragmentation complete...
UrzuSeven7 1 year ago 25
@bhexric the pivots are most definitely random, look at where the first pivot is... its like 80% of the way to the right hand side. You CAN write quicksort to chose the median for the pivot, but this one doesn't.
rolfsaurusa 1 year ago 3