Question 16Asked in DSSSB TGT Computer Science (Technical), 1 Aug 2021, Shift 3

How many interchanges will happen when the sequence of letters of "SORTED" is sorted using bubble sort?

  1. A36
  2. B11
  3. C18
  4. D6
Show answerHide answer

Correct answer: (B) 11

Explanation

Bubble sort makes one swap per inversion. In S O R T E D (order D < E < O < R < S < T), the inversions are S:4, O:2, R:2, T:2, E:1, totalling 11 interchanges.

From DSSSB TGT Computer Science PYQ (Technical), 1 Aug 2021, Shift 3

This is question 16 of DSSSB TGT Computer Science PYQ (Technical), 1 Aug 2021, Shift 3. 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.