In bubble sort, how many iterations are required to completely sort an array of size n, where n is the number of elements in the array?

  • n
  • n log n
  • n/2
  • n^2
In bubble sort, where each iteration places the largest unsorted element to its correct position, n-1 iterations are required to sort an array of size n, making a total of (n-1) + (n-2) + ... + 1 iterations.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *