Beginner Data Structures & Algorithms
Q33 / 100

What is insertion sort best suited for?

Correct! Well done.

Incorrect.

The correct answer is B) Nearly sorted or small datasets, running in O(n) best case

B

Correct Answer

Nearly sorted or small datasets, running in O(n) best case

Explanation

Insertion sort has O(n) best case on nearly sorted data (few swaps needed) and O(n²) worst case. It's efficient for small n and is used as a subroutine in Timsort.

Progress
33/100