简体   繁体   中英

Inbuilt java sorting algorithms for array/linked lists that uses Quicksort

I need to bench mark my quick sort algorithm with an inbuilt java sort. Since I am using arraylists and linkedlists, I need an inbuilt java sort that would sort with quick sort.

I have tried Arrays.sort(), but there doesn't seem to work for array and linked lists as arguments.

And also from Why does Collections.sort use Mergesort but Arrays.sort does not? It is said that the collections.sort() uses merge sort, and that there isn't any inbuilt sort for non primitive types that uses quick sort cause of stability requirements.

So how might I use an inbuilt java algorithm that uses Quicksort to sort arraylist and linkedlists?

Would it be a way to reverse the test-procedure?
Modify your sorting algorithm to work with an array and use Arrays.sort() to match it.
Both classes – ArrayList and LinkedList – are having a toArray() function.
Arrays.sort() calls java.util.ComparableTimSort.sort() internally.

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