def test_BigO(BigO):
    print(BigO.genRandomArray(20))
    print(BigO.genRandomString(5, 20))
    print(BigO.genSortedArray(20))
    print(BigO.genReversedArray(20))
    print(BigO.genPartialArray(20))
    print(BigO.genKsortedArray(20, 6))

    for i in range(21):
        arr = BigO.genKsortedArray(20, i)
        assert isKSortedArray(arr, i) == True

    print(BigO.genAlmostEqualArray(9))
    print(BigO.genAlmostEqualArray(20))
    print(BigO.genEqualArray(20))
    print(BigO.genHoleArray(20))
    print(BigO.genRandomBigArray(20))
from bigO import BigO
from bigO import utils


@utils.isSorted
def bubbleSort(array):  # in-place | stable
    isSorted = False
    counter = 1  # not correct
    while not isSorted:
        isSorted = True
        for i in range(len(array) - 1 - counter):
            if array[i] > array[i + 1]:
                array[i], array[i + 1] = array[i + 1], array[i]
                isSorted = False

        counter += 1

    return array


if __name__ == "__main__":
    bubbleSort(BigO.genRandomArray(100))