Question 47Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 2 (1:00 PM)

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?
  1. A120
  2. B210
  3. C105
  4. D225
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.

From DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 2 (1:00 PM)

This is question 47 of DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 2 (1:00 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.