Are there any resources on how the mergeSort used by Arrays.sort(Object[] a) is implemented? While it is documented quite good, I have a hard time understanding it (especially why the src and dest are are switched when mergeSort() get's recursively called).
Here is the source of java.util.Arrays.
Actually, you have that source code in the JDK - just open java.util.Arrays in your IDE and the source code + the comments will appear. If you don't have an IDE, look at JDK_HOME\src.zip
Then, put it in your IDE and trace how it works.
System.out.println(..)
// Recursively sort halves of dest into src
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With