简体   繁体   中英

mergesort and java implementation

Suppose I want to use the mergesort algorithm. Does JAVA has a method/function which implements the mergesort algorithm?

Or do I have to "manually" code the algorithm?

I do not know JAVA at all.

是的,有Arrays.sort(Object []) ,OpenJDK有一个源代码示例

You could use Collections.sort()

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). This algorithm offers guaranteed n log(n) performance.

No there isn't a merge sort out of the box. A simple google after 'java mergesort' should give you plenty of useful results

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM