The best-case time complexity of bubble sort (with a swap flag) is:
Show answerHide answer
Correct answer: (C) O(n)
Explanation
One pass with no swaps on an already sorted array.
Correct answer: (C) O(n)
Explanation
One pass with no swaps on an already sorted array.
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.