What is the difference between quicksort and customized quicksort?

What is the fundamental difference between quicksort and quicksort setup? What improvement does quicksort give? How does Java decide to use this instead of merge sort?

+5
source share
3 answers

"Tuned" quicksort simply means that some improvements apply to the underlying algorithm . Usually, improvements should try to avoid worse temporal complexity. Some examples of improvements may be to select an anchor point (or several anchor points) so that there is not only 1 key in this section, or only make a recursive call when the section exceeds a certain minimum size.

Java seems to use merge sorting when sorting objects ( Arrays doc tells you which sorting algorithm is used to sign the sorting method), so I don’t think it really “solves” by itself, but the decision was made in advance. (In addition, developers can use a different view if it is stable.)

+4

, - , - O (N log N) - , O (N ^ 2) , , N log N .

, . , 1:1 (, 10000: 1). , :

  • , . , , , , O (N ^ 2). , , O (N ^ 2) ([1,2,3,4,5,4,3,2,1] ).

  • , / , O (N ^ 2). , . , quicksort , [< p | >= p], .

? , , . , , O (N ^ 2) , . , . .

, , Bentley-McIlroy paritioning ( pdf) . Bentley-McIlroy , . , , , .

, :

  • quicksort . , .

  • , . O (N ^ 2), N quicksort.

  • , quicksort.

  • .

  • .

Java mergesort , ( , , ). Quicksort , , .

+7

java Arrays.sort(Object []) ,

, 7, 7,

.

+2

All Articles