#C11774. Taco: Sorting Numbers Without Built-In Functions
Taco: Sorting Numbers Without Built-In Functions
Taco: Sorting Numbers Without Built-In Functions
You are given a list of integers that needs to be sorted in ascending order. Your task is to implement a sorting algorithm without using any built-in sorting functions. The algorithm should be implemented via a simple bubble sort method. In particular, your program should read input from stdin and print the sorted result to stdout as space-separated integers.
The first line of input contains an integer \(n\) denoting the number of elements. If \(n > 0\), the next line contains \(n\) space separated integers. For an empty list (i.e. when \(n=0\)), your program should output nothing.
Example:
Input: 5 5 4 3 2 1</p>Output: 1 2 3 4 5
inputFormat
The input begins with an integer \(n\) (\(0 \le n \le 10^4\)), which denotes the number of integers to sort. If \(n > 0\), the second line contains \(n\) space-separated integers. If \(n = 0\), there is no second line.
outputFormat
Output the sorted list of integers in ascending order as space-separated values on a single line. For the case where \(n = 0\), output nothing.
## sample0