3 ms·
> completely failed even the most basic system / coding questions. But could they at least tell you why quick sort was the best sorting algorithm?
by clifanatic 10y ago
> completely failed even the most basic system / coding questions.
But could they at least tell you why quick sort was the best sorting algorithm?
- PetahNZ 10y agoBecause its quick, right?
- thechao 10y agoIt also sorts.
- danesparza 10y agoAlso: It has a cool name. It's much better than 'slowsort'
- tankenmate 10y agoApart from the fact that it isn't always the best sorting algorithm and it's pathological worst case is in fact as bad as a bubble sort's worst case (O(n^2) with a higher base operational cost, as at least bubble sort's worst case is somewhat cache friendly). This happens in three cases; 1) all the elements are sorted in descending order, 2) all the elements are sorted in ascending order, or 3) a special case of 1) and 2) combined, all the elements are equal.