#C14741. Bubble Sort Implementation

    ID: 44424 Type: Default 1000ms 256MiB

Bubble Sort Implementation

Bubble Sort Implementation

Implement the Bubble Sort algorithm to sort a list of integers in ascending order. Bubble Sort is a simple comparison-based algorithm where each pair of adjacent elements is compared and the elements are swapped if they are in the wrong order. This process is repeated until no swaps are needed.

The algorithm can be formally described by the condition: $$A_{ij} = \begin{cases} 1, & \text{if } a_i > a_j \\ 0, & \text{otherwise} \end{cases}$$ where a swap is performed if the above condition is met. Do not use any built-in sorting functions.

inputFormat

The first line of input contains an integer n, representing the number of integers. The second line contains n space-separated integers.

outputFormat

Output the sorted list in ascending order on a single line. The numbers should be separated by a single space. If the list is empty, output nothing.

## sample
0