Question DSA-SORT-0007
EasyWhat is the best-case time complexity of insertion sort (already sorted input)?
- A.
O(n log n)
- B.
O(1)
- C.
Show answer and explanation
Answer: D
Each element is compared once with its predecessor and stays put.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Sorting question
What is the best-case time complexity of insertion sort (already sorted input)?
O(n log n)
O(1)
Answer: D
Each element is compared once with its predecessor and stays put.
O(n²)
O(n)