def bubble_sort(a):
    """Bubble Sort

    Time complexity: O(n^2)
    Space complexity: O(1)

    :param a: A list to be sorted
    :type a: list
    :return: A new sorted list
    :rtype: list
    """

    b = [*a]
    n = len(b)
    for i in range(n):
        for j in range(n-i-1):
            if b[j] > b[j+1]:
                b[j], b[j+1] = b[j+1], b[j]
    return b