Merge Sort

May 22, 2020


Code on Github

Harry Potter sorting hat

Language

This problem was solve in Java.

Description

The problem this algorithm solves is the need to merge 2 sorted arrays together. I solved this problem as part of some homework for Data Structures I. I was pretty happy with the solution I had for this so I have included it here. Below I have some of the instructions the professor had given us for the problem.

Examples

There is no guarantee about the size of either array. When/if you run out of elements in either array, copy all the remaining elements from the nonempty array to the the new array.

Preconditions

Postcondition

Restrictions

You may not use any additional methods, sorting routines etc. For full credit, your solution may only go through each array one time ( so in particular - no nested loops)

Interactive Terminal

I have the repo of this algorithm linked to an interactive repl. If you would like to try the code out yourself feel free to go to the repl and give it a shot. It should by default run the test cases I have written and print in the terminal below .


Contact

Name: Gary Coffey
Email: garycoffey12@gmail.com
📞: 224-266-7476