public class MergeSort
extends java.lang.Object
| Constructor and Description |
|---|
MergeSort() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(java.lang.String[] args)
Assigns random values to each element of the integer array, displays
the array of values, sorts the array (calls the merge sort) and displays
the array again.
|
static void |
mergeSort(int left,
int right)
If the sub-array is equal to or more than one element, split the array into
two and call the recursive mergeSort(int, int) method.
|
static void |
showAll()
Prints the list of integer items in the array to the console.
|
public static void main(java.lang.String[] args)
args - the String[] array command line argumentpublic static void mergeSort(int left,
int right)
left - the index of the left-most element in the array or sub-arrayright - the index of the right-most element in the array or sub-arraypublic static void showAll()