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 in Java by krishna
• 2,540 points
13 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 in Java by krishna
• 2,540 points
13 views
0 votes
0 answers

Arrays of different types

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

4 days ago in Java by krishna
• 2,540 points
11 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,900 points
1,978 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
2,446 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,250 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,350 points
861 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
291 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,080 points
467 views
0 votes
0 answers

Quicksort with Python

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

Apr 26 in Python by Edureka
• 9,940 points
44 views
+5 votes
4 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,450 points

edited Nov 7, 2018 by Omkar 62,804 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP