Please implement bubble sort algorithm to sort a sequence of number in ascending order, and show the sequence of number after each iteration.
The bubble sort algorithm is shown in following:
At each iteration, it scans the whole array from left to right. While scaning each element, treat the element and its neighbor as a pair. If the order of the elements in the pair is reversed, swap the elements.
If there are N elements, N-1 iterations is needed.
There are 2 lines input.
The first line contains a integer n, indicating the total number of integers would be sorted. (1< n <= 100000)
The second line consists of the integers (the value is between -2147483648 and 2147483647) being sorted.
Show the sequence of number after each iteration.
If the input has n numbers, the output would have n-1 lines.
note: print a space before each number, and print '\n' in the end of each line.