Java Sort Algorithm

Can someone explain this sentence to me?

The sorting algorithm is a modified mergesort (in which merging is omitted if the highest element in the low list is less than the minimum element in the high list).

Link: Arrays.sort (Object [] arr)

I know how Merge works, but I still have a poor understanding. Thank.

+1
source share
2 answers

Mergesort recursively merges sorted sublists. If the current signatures that have the right to merge do not contain overlapping elements, there is no need to merge them. The merge operation will be skipped.

Example:

List A
1 4 8 9

List B
10 12 14 19

, 9 - A 10 ( B) , A. A B.

, , .

+3

, [1, 3, 4] [2, 5, 6]. , [1, 2, 3, 4, 5, 6].

[1] + [2] + [3, 4] + [5, 6] = [1, 2, 3, 4, 5, 6]

, , , [1, 2, 3] [4, 5, 6]. (3) (4). ; .

[1, 2, 3] + [4, 5, 6] = [1, 2, 3, 4, 5, 6]
0

All Articles