Question discussion

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 o…

358851Medium DSSSB TGT Computer Science 0 replies 0 views
0
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?
  • A120
  • B210
  • C105
  • D225
Correct answer: C

Explanation

In the worst case bubble sort makes n(n – 1)/2 comparisons. For n = 15 this is 15 × 14 ÷ 2 = 105.

Discussion 0

Nobody has replied yet. Start the discussion!