Question:

How many passes does an insertion sort algorithm take for sorting an array of ‘n’ elements?

Show Hint

Insertion sort starts from index 1 to \(n-1\), thus requires \(n-1\) passes.
Updated On: May 26, 2025
  • \(\dfrac{n}{2}\)
  • \(n\)
  • \(n - 1\)
  • \(n + 1\)
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Insertion sort compares each element with the elements before it, starting from the second position. Therefore, for \(n\) elements, it takes \(n - 1\) passes.
Was this answer helpful?
0
0