Explain insertion sort best case and worst case time complexity
Answers
Answered by
1
Answer:
Explanation:
When analyzing algorithms, the average case often has the same complexity as the worst case. So insertion sort, on average, takes O(n2) time. Insertion sort has a fast best-case running time and is a good sorting algorithm to use if the input list is already mostly sorted.
Answered by
0
Insertion sort has a fast best-case running time and is a good sorting algorithm to use if the input list is already mostly sorted. For larger or more unordered lists, an algorithm with a faster worst and average-case running time, such as mergesort, would be a better choice.
Similar questions