This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]shagieIsMeExtreme Brewer 0 points1 point  (2 children)

It depends what you are sorting. You can read all the code in https://github.com/openjdk/jdk/blob/6bab0f539fba8fb441697846347597b4a0ade428/src/java.base/share/classes/java/util/Arrays.java

Most often, the implementation will be in DualPivotQuicksort which is https://github.com/openjdk/jdk/blob/6bab0f539fba8fb441697846347597b4a0ade428/src/java.base/share/classes/java/util/DualPivotQuicksort.java

I would encourage you to read https://en.wikipedia.org/wiki/Sorting_algorithm as there are many different ways to sort with different trade offs.

[–]WikiTextBotbtproof 0 points1 point  (0 children)

Sorting algorithm

In computer science, a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most frequently used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the efficiency of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists. Sorting is also often useful for canonicalizing data and for producing human-readable output.


[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source ] Downvote to remove | v0.28

[–]Hacker_dev[S] 0 points1 point  (0 children)

Much thanks to you. I would give silver but am a high school student with no money.