🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Searching and Sorting in C: all 10 questions

Quiz: Searching and Sorting in C · Question 5 of 10

What is the best-case time of insertion sort, and when does it happen?

What is the best-case time of insertion sort, and when does it happen?

  1. A.O(n²), on sorted input
  2. B.O(n), on already sorted input
  3. C.O(log n), on sorted input
  4. D.O(1), on reverse-sorted input
Answer & explanation

Correct answer: O(n), on already sorted input

On sorted input each new element is already in place, so the inner loop stops after one comparison.

Can you get the rest right without peeking?

Take the timed Quiz: Searching and Sorting in C quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →