Can anyone explain me this sentence please?
The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist).
Link: Arrays.sort(Object[] arr)
I know how Merge works, but I still don't understand well. Thank you.
Mergesort recursively merges sorted sublists. If the current sublists eligible for merging contain no overlapping elements, there's no need to merge them. The merge operation would be skipped.
Example:
List A
1 4 8 9
List B
10 12 14 19
There's no need to go through the process of comparing these lists because 9 is the largest element of A and 10 (the first element of B) is larger than the largest element of A. The result would just be the concatenation of A and B.
All the document is saying is that they take a shortcut if comprehensive processing is unnecessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With