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

Posted by ram a... on 08. May 2015

Marcel Mueller writes:




If you have no further information about the data to sort and you have
random access merge sort and its derivatives are probably best for
general purpose. Everything else depends.




If one has a huge array, it is well possible that the largest
possible gain comes from sorting an array of primitves (int)
versus an array of references (Integer).



Then, one also might try to parallelize the sort by sorting
parts of the array in parallel and then merging them in a
way that retains the ordering. I don't know whether parallelStream
operations are already available to do this. It seems that



java.util.Arrays.asList( "e", "j", "b", "d", "h" ).
parallelStream().sorted().forEachOrdered( java.lang.System.out::println );



prints the correct result, but I don't know the extend in
which this is parallelized.



A hack would be to encode keys of objects together with those
objects in a long number. Then, sort the long numbers in an
array of primitives and finally retrieve the objects from the
low 32 bits of the longs (using an additional array that maps
the numbers to the objects).


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: 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: Draw bolder(ly)? by Jeff ...

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

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

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

30. Mar 2015: For all algorithm enthusiasts by Algo-...

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

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

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

30. Mar 2015: Re: Is it legal to backport code from JDK8 to JDK6? by Jan B...

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

30. Mar 2015: Re: Draw bolder(ly)? by Knute...

30. Mar 2015: Re: Is it legal to backport code from JDK8 to JDK6? by Jan B...

30. Mar 2015: Draw bolder(ly)? by Knute...

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

30. Mar 2015: BASTARDO PUZZONECRIMINALE DAVIDE SERRA (ALGEBRIS TWITTER) HA BECCATO L'INSIDER SU BANCHE POPOLARI DAL MEGALAVASOLDI MAFIOSI PIERLUIGI BOSCHI DI BANCA ETRURIA. SON TUTTI FASCIONDRANGHETISTI, TIPO NOTO VERME PAOLO BARRAI DI WMO, CHE SI FINGON DEL PD.. by CHE S...

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

30. Mar 2015: Re: how to write this simple program? by Eric ...

30. Mar 2015: Is it legal to backport code from JDK8 to JDK6? by Haddo...

29. Mar 2015: Re: how to write this simple program? by Jeff ...

29. Mar 2015: Re: Microsoft Spartan will support Applets by Qu0ll...

29. Mar 2015: Re: how to write this simple program? by Jeff ...

29. Mar 2015: Re: how to write this simple program? by Jeff ...

29. Mar 2015: Re: how to write this simple program? by John ...

29. Mar 2015: Re: Microsoft Spartan will support Applets by Qu0ll...

29. Mar 2015: Re: how to write this simple program? by Eric ...

29. Mar 2015: how to write this simple program? by John ...

29. Mar 2015: Re: Microsoft Spartan will support Applets by Jeff ...

29. Mar 2015: Re: Microsoft Spartan will support Applets by Jeff ...

29. Mar 2015: Re: Microsoft Spartan will support Applets by Jeff ...

29. Mar 2015: Re: Microsoft Spartan will support Applets by Jeff ...

28. Mar 2015: Re: Microsoft Spartan will support Applets by Andre...

28. Mar 2015: Re: Microsoft Spartan will support Applets by Andre...

28. Mar 2015: Re: Microsoft Spartan will support Applets by Qu0ll...

28. Mar 2015: Re: Microsoft Spartan will support Applets by Qu0ll...

27. Mar 2015: Re: high quality replica dooney bourke handbags, china dooney & bourke by lugga...

27. Mar 2015: Re: using two different versions of JAR files by Jeff ...

27. Mar 2015: Re: Microsoft Spartan will support Applets by Andre...

27. Mar 2015: Re: using two different versions of JAR files by John ...

27. Mar 2015: Re: Microsoft Spartan will support Applets by Qu0ll...

27. Mar 2015: Re: Microsoft Spartan will support Applets by Qu0ll...

27. Mar 2015: Re: Microsoft Spartan will support Applets by Qu0ll...

27. Mar 2015: Re: Microsoft Spartan will support Applets by Qu0ll...

27. Mar 2015: Re: Microsoft Spartan will support Applets by Qu0ll...

27. Mar 2015: Re: PRINTING DIAMOND SHAPE WITH LOOPS! by rotic...

26. Mar 2015: Re: Microsoft Spartan will support Applets by Silvi...

26. Mar 2015: Re: Microsoft Spartan will support Applets by Qu0ll...

26. Mar 2015: Re: using two different versions of JAR files by Jeff ...

26. Mar 2015: Re: using two different versions of JAR files by Jeff ...

26. Mar 2015: Re: using two different versions of JAR files by Jeff ...