Explain why, in the worst case, the number of comparisons is of O(n^2) for the insertion sort.?
- QuentinLv 71 year agoFavourite answer
When a new item it inserted it has to be compared to all the other items present.
At first there's 1
Add all these up and it's n(n-1)/2 which neglecting the 1 and the factor ½ equals n^2
Still have questions? Get answers by asking now.