Q. Show the various passes of bubble sort on the unsorted given list 11, 15, 2, 13, 6
Ans:
The given data is as follows:-
Pass 1:-
11 15 2 13 6
11 15 2 13 6
11 2 15 13 6
11 2 13 15 6
11 2 13 6 [15]
Pass 2:-
11 2 13 6 15
2 11 13 6 15
2 11 13 6 15
2 11 6 [13 15]
Pass 3:-
2 11 6 13 15
2 11 6 13 15
2 6 [11 13 15]
Pass 4:-
2 6 11 13 15
2 [6 11 13 15]
Therefore, the sorted array becomes:-
2 6 11 13 15