Answer:It is the easiest way to sort a table. The sort is being performed from the first element; a search is performed to locate the element that is smaller than the key element. When this element is found, it is interchanged with the first element in the table. A search for the second smallest key is then carried out. Then it is started from the second element onwards. The element, which has the second smallest key, is interchanged with the element located in second position of table. This process continues till the array is in ascending order.
Pass:
Initially the elements of the array are:
9 8 7 6 5 4 3 2 1
|-- 9 1 1 1 1 1 1 1 1 1 --|
|-- 8 9 2 2 2 2 2 2 2 2 --|
|-- 7 8 9 3 3 3 3 3 3 3 --|
|-- 6 7 8 9 4 4 4 4 4 4 --|
|-- 5 6 7 8 9 5 5 5 5 5 --|
|-- 4 5 6 7 8 9 6 6 6 6 --|
|-- 3 4 5 6 7 8 9 7 7 7 --|
|-- 2 3 4 5 6 7 8 9 8 8 --|
V- 1 2 3 4 5 6 7 8 9 9 -V