Bubble Sort

1. What will be the time complexity of the regular unoptimized bubble sort algorithm in the best case, i.e, when the input array is already sorted?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

2. Consider the following array:
A = [-10, 100, 1, 0, 9, 1*]
Note that the ‘*’ is used to mark a distinction between the two 1’s in order to keep track of their order while sorting. What will be the final output of the algorithm for this array (assume ascending order sort)?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

3. What is the time complexity of the algorithm in the worst case?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

4. What will be the space complexity of the bubble sort algorithm?
Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation

Explanation