Computer Science EngineeringHard

The best-case running time of insertion sort (already sorted input) is

  1. A. O(n^2)
  2. B. O(n log n)
  3. C. O(log n)
  4. D. O(n)

Correct answer: D. O(n)

Each element needs a single comparison, so the total is linear.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic