def sort_012(input_arr):
    """
    Given an input array consisting on only 0, 1, and 2, sort the array in a single traversal.

    Time Complexity O(n)
    Space Complexity O(n)
    Where n is the array size.  
    
    Args:
       input_arr(array): Array to be sorted
       
    Returns:
        sorted_arr(array): Sorted array
    """
    # Test that input_arr consists of digits between 0 and 9
    for element in input_arr:
        if element < 0 or element > 2:
            return (-1, -1)
        
    bin_zeros = []
    bin_ones = []
    bin_twos = []
    
    for element in input_arr:
        if element == 0:
            bin_zeros.append(element)
        elif element == 1:
            bin_ones.append(element)
        elif element == 2:
            bin_twos.append(element)
    
    sorted_arr = bin_zeros + bin_ones + bin_twos         
    return sorted_arr