Question:

If a list contains ’n’ number of elements and all the elements are by default sorted in ascending order, how many comparisons will be required during 1st pass of bubble sort to arrange the list in ascending order?

Updated On: Nov 4, 2024
  • 0
  • 1
  • n - 1
  • n
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Bubble Sort makes n - 1 comparisons in the first pass, even if the list is already sorted, but no swaps occur.
Was this answer helpful?
0
0