<jupyter_start><jupyter_text>Given a list of unique random intergers:- Split and merge sub lists into a sorted list  PREQUISITES<jupyter_code>import random

def make(n):
    nums = [i for i in range(n)]
    for i in range(n):
        rnd = random.randint(0, n - 1)
        nums[i], nums[rnd] = nums[rnd], nums[i]
    return nums<jupyter_output><empty_output><jupyter_text>ALGORITHM<jupyter_code>def mergeSort(nums):
    if len(nums) > 1:
        L = nums[:len(nums) // 2]
        R = nums[len(nums) // 2:]
        
        mergeSort(L)
        mergeSort(R)
        
        idx_l, idx_r, idx = 0, 0, 0
        
        while idx_l < len(L) and idx_r < len(R):
            if L[idx_l] < R[idx_r]:
                nums[idx] = L[idx_l]
                idx_l += 1
            else:
                nums[idx] = R[idx_r]
                idx_r += 1
            idx += 1
                
        while idx_l < len(L):
            nums[idx] = L[idx_l]
            idx_l += 1
            idx += 1
            
        while idx_r < len(R):
            nums[idx] = R[idx_r]
            idx_r += 1
            idx += 1<jupyter_output><empty_output><jupyter_text>TEST<jupyter_code>nums = make(20)
mergeSort(nums)
print(nums)

for idx, val in enumerate(nums):
  assert idx == val<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup