Implemented MergeSort which works inside the input array instead of creating lots of new arrays