Problems
Selection sort is an internal sorting algorithm that works as follows:
Find the minimum value in the given sequence (if there are multiple identical values, choose the first one).
Swap the found minimum value with the value at the front.
Exclude the first value from the sequence, and repeat the same process on the remaining sequence for a total of
N-1 times.
Given a sequence of
Input
The first line contains the length of the sequence
The second line contains
Output
Excluding the initial state, print the sequence after each step of the selection sort.
Follow the output format as described (each step on a separate line, numbers separated by spaces).
Example
5
6 4 8 3 1
1 4 8 3 6
1 3 8 4 6
1 3 4 8 6
1 3 4 6 8
Tag
Source
JUNGOL