Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Quicksort ain't shit

Name: Anonymous 2016-08-15 17:16

The fact that it's a commonly taught sorting algorithm is just an accident of history and imperative languages' being popular. It's actually quite a lot more complex than merge sort or heap sort and it's much harder to analyze. (Proving that merge sort runs in O(n log n) is relatively easy; proving that quicksort runs in O(n log n) in expectation is quite hard.)

Name: Anonymous 2016-08-16 0:45

The only real reason to sort is to compare structures more easily (check all objects against all other objects for interactions while sorted can be optimized in certain ways, for example) which are usually O(n2) anyway. Searching is always going to be O(n) in the worst case, sorted or not. And if order is actually important, you should be using something like AVL or Red-Black trees. Sorting shouldn't be done often enough that the time complexity of the algorithm used should be anything significant.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List