Suppose there are 15 elements in the array that apply bubble sort technique to sort the
Suppose there are 15 elements in the array that apply bubble sort technique to sort the
elements of the array. What is the maximum number of comparisons, in worst case,
required to sort the elements of array in ascending order?
Show answerHide answer
Correct answer: (C) 105
Explanation
Bubble sort makes (n-1) + (n-2) + ... + 1 = n(n-1)/2 comparisons in the worst case. For n = 15 that is 15 x 14 / 2 = 105.