February 2014
Beginner
1248 pages
62h 25m
English
Figure 19.6 declares the MergeSortTest class, which contains:
• static method mergeSort to initiate the sorting of an int array using the merge sort algorithm
• static method sortArray to perform the recursive merge sort algorithm—this is called by method mergeSort
• static method merge to merge two sorted subarrays into a single sorted subarray
• static method subarrayString to get a subarray’s String representation for output purposes, and
• main to test method mergeSort.
Method main (lines 101–116) is identical to main in Figs. 19.4–19.5 except that line 112 calls method mergeSort. The output from this program displays the splits and merges performed by merge sort, showing the progress of the sort at each ...
Read now
Unlock full access