Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
458 B
3
Indexable
Never
def quicksort(nums):
    if len(nums) <= 1:
        return nums
    else:
        q = nums[len(nums)//2]
        print(q, end=' ')
    l_nums = [n for n in nums if n < q]

    e_nums = [q] * nums.count(q)
    b_nums = [n for n in nums if n > q]
    return quicksort(l_nums) + e_nums + quicksort(b_nums)


if __name__ == "__main__":
    m = int(input())
    matr = []
    for i in range(m):
        matr += list(map(int, input().split()))
    quicksort(matr)