InterviewSolution
Saved Bookmarks
| 1. |
Write the resultant array after 3 pass of Bubble sort: { 34, 76, 12, 89, 22, 66, 3} |
|
Answer» In each step, ELEMENTS written in bold are being compared. Three passes will be required; First Pass Explanation: Complexity Analysis of Bubble Sort Hence the TIME complexity of Bubble Sort is O(n2). The MAIN advantage of Bubble Sort is the simplicity of the algorithm. The space complexity for Bubble Sort is O(1), because only a single additional memory space is required i.e. for temp variable. |
|