Here we will be constructing our own merge sort.
Using the mergeSort()
method, write in your logic for merge sorting a series of integers.
The method will be provided an unsorted array of integers as a parameter along with the length of the array as n
.
What should be printed is an array in ascending order.
Ex:
input -> [3,2,5,1,4]
output -> [1,2,3,4,5]
Be sure to be mindful of the array indices as ArrayIndexOutOfBoundsExceptions
are very common.
You can conduct your own testing and debugging as you please by inserting System.out.print()
. However, we do have our own set of test cases.
The lab comes with a couple of pre-built tests cases that will verify the correct functionality of your implementation. Go over to the check mark on the left hand side of the IDE and hit Run tests. All green means you have passed the test cases. Red will mean you failed a test case, or an error occured. Read the stack trace to investigate why you are not passing the test cases.