Why does Java s Arrays sort method use two different sorting algorithms for different types

0 votes
The array.sort method in Java 6 makes use of quicksort for arrays of primitives and mergesort for arrays of object. From my perspective, quicksort is faster than mergesort, It also uses less memory and time complexity for both are O(n log(n)). So why is it that both methods are being used for different types?
Aug 3, 2022 in Java by krishna
• 2,820 points
289 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Java

0 votes
0 answers

Sort arrays of primitive types in descending order

I got a huge array of double ...READ MORE

Aug 3, 2022 in Java by krishna
• 2,820 points
669 views
0 votes
0 answers

Arrays of different types

Is it possible to have an array ...READ MORE

Aug 8, 2022 in Java by krishna
• 2,820 points
238 views
0 votes
2 answers

How to concatenate two arrays in Java?

public <T> T[] concatenate(T[] a, T[] b) ...READ MORE

answered Jul 19, 2018 in Java by Sushmita
• 6,910 points
2,404 views
0 votes
2 answers

What is the use of toString method in Java and how can I use it ?

Whenever you require to explore the constructor ...READ MORE

answered Aug 23, 2018 in Java by Daisy
• 8,120 points
3,758 views
0 votes
1 answer

Why the main() method in Java is always static?

As you might know, static here is ...READ MORE

answered May 9, 2018 in Java by geek.erkami
• 2,680 points
1,882 views
0 votes
1 answer

What does Java option -Xmx stand for?

-Xmxn: It specifies the maximum size, in bytes, ...READ MORE

answered May 9, 2018 in Java by sharth
• 3,370 points
1,387 views
0 votes
0 answers

How to merge two sorted arrays into a sorted array?

this question was asked in interview  public static ...READ MORE

Nov 17, 2022 in Others by Ashwini
• 5,430 points
319 views
+1 vote
1 answer

Quicksort in Python

The following code may solve your problem: def ...READ MORE

answered Sep 20, 2018 in Python by SDeb
• 13,300 points
517 views
+1 vote
1 answer

Implement Quicksort in Python

This will help you. def sort(array=[2,5,1,6,9,8,7,10,21,12]): ...READ MORE

answered Oct 30, 2018 in Python by Priyaj
• 58,090 points
808 views
0 votes
0 answers

Quicksort with Python

I am totally new to python and ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,620 points
256 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP