Bubble Sort

1. How many iterations of the outer and inner loops will it take to sort the following array using the optimized algorithm?
A = [-4, -9, -1, 8, -9, 4]
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

2. Consider the following array:
A = [8, 7, -2, 4, 1]
Which of the following will represent the array after the 3rd iteration of the algorithm (assume ascending order sort)?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

3. Consider the following array:
A = [8, 7, -2, 4, 1]
How many swaps occur in the 1st iteration of the outer loop?

Explanation

Explanation

Explanation

Explanation

4. Consider the following array:
A = [-10, 100, -1000, 2, 0, -1]
How many iterations of the outer loop will it take to sort this array as per the optimized bubble sort?

Explanation

Explanation

Explanation

Explanation