Implement merge sort from scratch.
Given an array of integers nums, sort it in ascending order using the merge sort algorithm and return the sorted array.
Merge sort is a divide-and-conquer algorithm:
Do not use any built-in sort functions.
nums = [38, 27, 43, 3, 9, 82, 10][3, 9, 10, 27, 38, 43, 82]nums = [5, 1, 4, 2][1, 2, 4, 5]nums = [1][1]1 <= nums.length <= 5000-10^4 <= nums[i] <= 10^4You must implement merge sort (do not use built-in sort)Run your code to see results
Use Cmd+Enter to run