Create a public class named
Mergesort that provides a single instance method (this is required for testing)
mergesort accepts an
IntArray and returns a sorted (ascending)
IntArray. You should not
modify the passed array.
Mergesort should extend
Merge, and its parent provides several helpful methods:
fun merge(first: IntArray, second: IntArray): IntArray: this merges two sorted arrays into a second sorted array.
fun copyOfRange(original: IntArray, from: Int, to: Int): IntArray: this acts as a wrapper on
java.util.Arrays.copyOfRange, accepting the same arguments and using them in the same way.
(You can't use
java.util.Arrays in this problem for reasons that will become obvious if you inspect the rest of
Note that you do need to use
merge and call it the correct number of times.
This will be tested during grading.
You should use an array of size 1 or 0 as your base case.