#C12317. In-Place Bubble Sort

    ID: 41731 Type: Default 1000ms 256MiB

In-Place Bubble Sort

In-Place Bubble Sort

You are given an array of integers. Your task is to sort the array in-place using the Bubble Sort algorithm. The sorted order should be in non-decreasing order.

In Bubble Sort, adjacent elements are compared and swapped if they are in the wrong order. The process is repeated until the array is sorted. The worst-case time complexity of Bubble Sort is \(O(n^2)\), where \(n\) is the number of elements.

Note: You must implement the sorting algorithm yourself without using built-in sort functions.

inputFormat

The input is read from stdin and follows this format:

  1. The first line contains an integer \(n\) representing the number of elements in the array.
  2. The second line contains \(n\) space-separated integers.

outputFormat

Output the sorted array to stdout in one single line. The elements should be printed as space-separated integers. If the array is empty, output an empty line.

## sample
1
5
5

</p>