Re: best and worst sorting algorithm for 1 to 10,000 and then 10,000 + elements

Posted by Marti... on 08. May 2015

On Mon, 04 May 2015 10:39:26 -0700, Ajay Paul wrote:




what are the best and worst sorting algorithm for 1 to 10,000 and then
10,000 + elements.



I understand that bubble short is worst.




The relative cost of the key comparison and element swap steps is
important. Some will tell you that quicksort is significantly faster than
shell-sort without qualifying that statement but that it only true if key
comparison has a lower cost than swapping elements: if key comparison is
expensive, i.e. there are multiple keys in each item and each key
comparison is expensive (such as caseless comparisons) then quicksort
becomes the slower algorithm because it minimises element swaps on the
assumption that key comparison is always cheaper than swapping items.



Bottom line: as others have said, use the standard Collection sorts
unless properly instrumented tests show their (lack of) performance is
causing problems.





martin@ | Martin Gregorie
gregorie. | Essex, UK
org |


07. Apr 2015: Re: Return of the Applets? by Jerry...

07. Apr 2015: Re: Return of the Applets? by ram a...

07. Apr 2015: Re: Return of the Applets? by Marti...

07. Apr 2015: Re: Return of the Applets? by Marti...

07. Apr 2015: Re: Return of the Applets? by Jerry...

07. Apr 2015: Re: Return of the Applets? by Jerry...

07. Apr 2015: Re: Return of the Applets? by Leif ...

07. Apr 2015: Re: Return of the Applets? by Leif ...

07. Apr 2015: Re: Return of the Applets? by Jerry...

07. Apr 2015: Re: presentable Java features and programs by Jeff ...

07. Apr 2015: Re: Return of the Applets? by Jerry...

06. Apr 2015: Re: Return of the Applets? by Marti...

06. Apr 2015: presentable Java features and programs by ram a...

06. Apr 2015: Re: Return of the Applets? by Joshu...

06. Apr 2015: Re: presentable Java features and programs by Eric ...

06. Apr 2015: Re: Return of the Applets? by Kevin...

06. Apr 2015: Re: presentable Java features and programs by Arne ...

06. Apr 2015: Re: presentable Java features and programs by Jeff ...

06. Apr 2015: Re: presentable Java features and programs by Arne ...

06. Apr 2015: Re: presentable Java features and programs by Jeff ...

06. Apr 2015: Re: presentable Java features and programs by Eric ...

06. Apr 2015: Re: presentable Java features and programs by Jeff ...

06. Apr 2015: Re: Return of the Applets? by Jerry...

06. Apr 2015: Re: Return of the Applets? by Jerry...

06. Apr 2015: Re: presentable Java features and programs by Jerry...

06. Apr 2015: Re: Return of the Applets? by Joshu...

06. Apr 2015: Re: Return of the Applets? by Jerry...

06. Apr 2015: Re: Return of the Applets? by Joshu...

06. Apr 2015: Re: Return of the Applets? by Jan B...

06. Apr 2015: Re: Return of the Applets? by Jan B...

06. Apr 2015: Re: Return of the Applets? by Jan B...

06. Apr 2015: Re: Return of the Applets? by Jerry...

06. Apr 2015: Re: Any good book/website with samples how to run Java in web applications? by Marti...

06. Apr 2015: Re: Return of the Applets? by Joshu...

06. Apr 2015: Re: Return of the Applets? by Joshu...

06. Apr 2015: Re: Return of the Applets? by Luuk ...

06. Apr 2015: Re: Return of the Applets? by Richa...

06. Apr 2015: Re: Return of the Applets? by Jeff ...

06. Apr 2015: Re: Return of the Applets? by Jeff ...

06. Apr 2015: Re: What are the professional development kits for Java by david...

05. Apr 2015: Re: Return of the Applets? by Arne ...

05. Apr 2015: Re: Return of the Applets? by Arne ...

05. Apr 2015: Re: Any good book/website with samples how to run Java in web applications? by Arne ...

05. Apr 2015: Re: Return of the Applets? by Jerry...

05. Apr 2015: Re: Return of the Applets? by Arne ...

05. Apr 2015: Re: Return of the Applets? by Jerry...

05. Apr 2015: Re: Any good book/website with samples how to run Java in web applications? by dffdf...

05. Apr 2015: Re: Return of the Applets? by ram a...

05. Apr 2015: Re: Return of the Applets? by Arne ...

05. Apr 2015: Re: Any good book/website with samples how to run Java in web applications? by Arne ...

05. Apr 2015: Re: Return of the Applets? by Arne ...

05. Apr 2015: Re: Return of the Applets? by Jerry...

05. Apr 2015: Re: Return of the Applets? by Arne ...

05. Apr 2015: Re: Any good book/website with samples how to run Java in web applications? by dffdf...

05. Apr 2015: Re: Return of the Applets? by Jerry...

05. Apr 2015: Re: Integer.parseInt() and whitespace? by Jukka...

05. Apr 2015: Re: Any good book/website with samples how to run Java in web applications? by dffdf...

05. Apr 2015: Re: Any good book/website with samples how to run Java in web applications? by Arne ...

05. Apr 2015: Re: Integer.parseInt() and whitespace? by Arne ...

05. Apr 2015: Re: Return of the Applets? by Jeff ...

05. Apr 2015: Re: What are the professional development kits for Java by Arne ...

05. Apr 2015: Re: Return of the Applets? by Jerry...

05. Apr 2015: Return of the Applets? by ram a...

05. Apr 2015: Re: Integer.parseInt() and whitespace? by ram a...

04. Apr 2015: Any good book/website with samples how to run Java in web applications? by dffdf...

04. Apr 2015: Re: What are the professional development kits for Java by Arne ...

04. Apr 2015: Integer.parseInt() and whitespace? by galt_...

04. Apr 2015: What are the professional development kits for Java by dffdf...

04. Apr 2015: Re: Client and ... ? by Jeff ...

04. Apr 2015: Muhammad's Sword by BV BV...

04. Apr 2015: Re: how to write this simple program? by Lew l...

04. Apr 2015: Re: Client and ... ? by Lew l...

03. Apr 2015: Re: Simple if-exercises by v_bor...

03. Apr 2015: Re: Simple if-exercises by Marti...

03. Apr 2015: Re: Simple if-exercises by Jeff ...

03. Apr 2015: Re: Simple if-exercises by Marti...

03. Apr 2015: Re: Simple if-exercises by v_bor...

03. Apr 2015: Re: Simple if-exercises by Eric ...

03. Apr 2015: Re: Simple if-exercises by Marti...

03. Apr 2015: Re: Simple if-exercises by Eric ...

03. Apr 2015: Re: Simple if-exercises by v_bor...

03. Apr 2015: Get Access to the Professional Videos of Java at ITeLearn by charl...

02. Apr 2015: Re: Simple if-exercises by Gene ...

02. Apr 2015: Re: Simple if-exercises by Jerry...

02. Apr 2015: Re: Simple if-exercises by Marti...

02. Apr 2015: Re: Simple if-exercises by Jeff ...

02. Apr 2015: Re: Simple if-exercises by Jeff ...

02. Apr 2015: Re: Simple if-exercises by Eric ...

02. Apr 2015: Simple if-exercises by ram a...

01. Apr 2015: Re: .parallelStream() by Sebas...

01. Apr 2015: .parallelStream() by ram a...

01. Apr 2015: Client and ... ? by ram a...

01. Apr 2015: Re: Is it legal to backport code from JDK8 to JDK6? by Haddo...

01. Apr 2015: Re: .parallelStream() by Eric ...

01. Apr 2015: Re: Client and ... ? by Jeff ...

31. Mar 2015: Re: Is it legal to backport code from JDK8 to JDK6? by Sebas...

31. Mar 2015: Re: Draw bolder(ly)? by Marti...

31. Mar 2015: Re: Is it legal to backport code from JDK8 to JDK6? by Fredr...

31. Mar 2015: Re: Is it legal to backport code from JDK8 to JDK6? by Fredr...

31. Mar 2015: Re: Draw bolder(ly)? by Jeff ...