🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Sorting Basics: all 13 questions

Quiz: Sorting Basics · Question 13 of 13

For which input does insertion sort do the most work?

For which input does insertion sort do the most work?

  1. A.An array that is already sorted
  2. B.An array where all values are equal
  3. C.An array sorted in reverse order
  4. D.An array with only two items
Answer & explanation

Correct answer: An array sorted in reverse order

Each new item must be shifted past all the items before it, giving O(n²) shifts.

Can you get the rest right without peeking?

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

Start the quiz →