#K35462. Selection Sort
Selection Sort
Selection Sort
In this problem, you are required to implement the selection sort algorithm.
The selection sort algorithm sorts a list of (n) numbers by repeatedly selecting the minimum element from the unsorted segment and swapping it with the first unsorted element. The time complexity of the algorithm is (O(n^2)).
Your program should read input from standard input (stdin) and output the result to standard output (stdout). Handle all edge cases including already sorted lists, reverse sorted lists, and lists with duplicate numbers.
inputFormat
The first line of input contains an integer (n) ((1 \le n \le 10^5)), representing the number of elements in the list. The second line contains (n) space-separated integers.
outputFormat
Output the sorted list of integers in ascending order on a single line, with each number separated by a space.## sample
5
64 34 25 12 22
12 22 25 34 64
</p>