Java的排序算法 [英] Java Sorting Algorithm

查看:87
本文介绍了Java的排序算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能给我解释一下这句话吗?

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).

链接:<一个href=\"http://download.oracle.com/javase/6/docs/api/java/util/Arrays.html#sort%28java.lang.Object%5B%5D%29\"相对=nofollow> 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.

例如:

List A
1 4 8 9

List B
10 12 14 19

有没有必要去通过,因为9是最大的元素和10(B的第一个元素)比A的最大元素大,结果也只是A的串联比较这些名单的过程和B

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.

所有跟它的文件是,他们走了一条捷径,如果COM prehensive处理是不必要的。

All the document is saying is that they take a shortcut if comprehensive processing is unnecessary.

这篇关于Java的排序算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆