Bubble Sort
1. What is the time complexity of the regular, unoptimized Bubble Sort algorithm in the best case, when the input array is already sorted?
2. Consider the following array:
A = [-10, 100, 1, 0, 9, 1*]
Here, '*' distinguishes the two occurrences of 1 so that their original order can be tracked. What will be the final output of Bubble Sort for this array, assuming ascending order?
A = [-10, 100, 1, 0, 9, 1*]
Here, '*' distinguishes the two occurrences of 1 so that their original order can be tracked. What will be the final output of Bubble Sort for this array, assuming ascending order?
3. What is the time complexity of Bubble Sort in the worst case?
4. What is the auxiliary space complexity of the Bubble Sort algorithm when sorting the array in place?
5. Which characteristic of Bubble Sort explains why equal elements can retain their original relative order?
6. Which statement best describes the difference between regular and optimized Bubble Sort?
7. In an ascending Bubble Sort, approximately how many comparisons are performed over all passes in the worst case for an array of N elements?
8. Why does Bubble Sort have O(1) auxiliary space complexity when implemented in place?
9. Which input arrangement generally causes the largest number of swaps in standard ascending Bubble Sort?