Which sorting algorithm provides the best performance in the worst case?

What is the fastest sorting algorithm for the absolute worst case? I don't care about the best case and accept a gigantic dataset, if that even matters.

+3
source share
17 answers

make sure you see this:

visualization of sorting algorithms - this helped me decide which type of alg to use.

+17
source

. , ( , ) radix, O (n). O (n log n).

+9

, O (N log N) . - , MergeSort HeapSort, O (N log N) .

HeapSort , , MergeSort ( ).

, Wikipedia, O (n log n) . ( mmyers)

+7

, : ( ) , O (n log n) !

( ) O (n log n)

O (n log n) ( )

n log n

, n log n, ,

Radix Bucket , . , .

+5

Quicksort, , , , Heapsort Mergesort. O(n log n) .

+2

(.. , ), , , //- - , .

; , /.

+2

, ( ).

/. " ", , .

+1

, Big O O (n).

BEST AND WORST CASE . - 2- MergeSort

+1

, , , , merge-sort, . , , VASTLY , .

, " ".

+1

, . , , Quicksort, , , , . , " " " " ( Quick Merge, ).

+1

, quicksort.

O (nlog n) , O (n ^ 2) , .

, .

0

. Vs Merge Sort Quicksort Mergesort, .

0

, . . O (n) , O (n ^ 2), , .

0

, ( , , ), quicksort .

0

, O (n log n). .

O (n log n), (, bead sort, ).

0

: radix , , , . , .

http://en.wikipedia.org/wiki/Radix_sort

PS This is the O (k * n) algorithm, where k is the key size.

0
source

It depends on the characteristics of the data.

-2
source

Source: https://habr.com/ru/post/1706832/


All Articles