Anonymous

# Explain why, in the worst case, the number of comparisons is of O(n^2) for the insertion sort.?

### 1 Answer

Relevance

- QuentinLv 77 months agoFavorite Answer
When a new item it inserted it has to be compared to all the other items present.

At first there's 1

then 2

then 3

...

then n

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 your answers by asking now.

thank you sooooo muuchhh Quentin for answering my question i appreciate it :)