How does merge sort work and what is its time complexity? If you had an 8-core CPU, how would you modify merge sort for a huge array and what would the time complexity be?
Asked in the Round 1 stage. Implement a function that returns a sorted copy of an integer array using the requested number of worker processes. Split the array into chunks, sort chunks independently, then merge them.
nums is a list of integers and cores is a positive integer. Return nums sorted in ascending order without modifying the input.
def parallel_merge_sort(nums, cores):