Is there a better sorting algorithm than QuickSort?
the ones that use comparision sorts, the best the can do its O(n x log(n)) so quicksort its the best as merge sort and heap sort. however there are others that doesnt use comparisions that have better times, here u can find and see them http://en.wikipedia.org/wiki/Sorting_algorithm
Previous answer is wrong; Quicksort is O(n*log n) only in the average case, but in the worst case it is O(n*log n). There are other algorithms that are ALWAYS O(n*log n) even in the worst case (e.g. Heap Sort and Merge Sort). So for general use on large arrays they could be superior unless you know in advance that the case in question is not one of the bad ones for Quicksort.
i never told him that quicksort its O(n * log(n)), fine if you made it clear, i just told that the best u can get doing ANY algotihm that use compatisions its O(n * log(n)) and quicksort behave pretty well just like merge and heap sort, if he wants something more powerful use one of the radix sorts that doesnt compare, hope this solve your question
Quicksort is excellent on unsorted data. If the data is almost sorted, the performance of quicksort degrades to being unacceptable. Mergesort and heapsort both have much better performance on almost sorted data, but quicksort will beat them noticeably on unsorted data.
Join our real-time social learning platform and learn together with your friends!