In the bubble sort algorithm, If there are no swaps then the array becomes in sorted order.
Consider the following array and how many passes or iterations it runs an optimized bubble sort algorithm?
Input: 42, 20, 10, 15, 19
Output: 10, 15, 19, 20, 42
1
1
2
2
3
3
4
4