from typing import List


def merge_sub(a : List[int], b : List[int]) -> List[int]:
    """A subroutine of merge sort 
    Worst-case performance: O(N)

    Parameters:
        a(List) : Unsorted List  
        b(List) : Unsorted List

    Returns:
        c(List) : Two pointer sorted List

    """
    n : int = len(a)
    m : int = len(b)
    i : int = 0
    j : int = 0
    k : int = 0
    c : List[int] = [ 0 for i in range(n+m)]

    while(i < n or j < m):
        if(j == m or (i < n and a[i] < b[j])):
            c[k] = a[i]
            k += 1
            i += 1
        else:
            c[k] = b[j]
            k += 1
            j += 1
    
    return c