Question 148

The best-case time complexity of bubble sort (with a swap flag) is:

  1. AO(n^2)
  2. BO(n log n)
  3. CO(n)
  4. DO(log n)
Show answerHide answer

Correct answer: (C) O(n)

Explanation

One pass with no swaps on an already sorted array.

From DSSSB TGT Computer Science Full Mock Test 3

This is question 148 of DSSSB TGT Computer Science Full Mock Test 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.