#C14201. Bubble Sort Algorithm
Bubble Sort Algorithm
Bubble Sort Algorithm
You are given a list of integers. Your task is to sort this list in non-decreasing order using the bubble sort algorithm. Bubble sort repeatedly traverses the list, compares adjacent elements, and swaps them if they are in the wrong order. This process is repeated until the list is sorted.
The algorithm's worst-case time complexity is $O(n^2)$, where $n$ is the number of elements in the list.
inputFormat
The input consists of two lines. The first line contains a non-negative integer $n$, which represents the number of elements in the list. The second line contains $n$ space-separated integers. If $n=0$, the second line will be empty.
outputFormat
Output a single line containing the $n$ integers sorted in non-decreasing order, separated by a single space. If the list is empty, output nothing.
## sample0