Yahoo Answers: Answers and Comments for Explain why, in the worst case, the number of comparisons is of O(n^2) for the insertion sort.? [Programming & Design]
Copyright © Yahoo! Inc. All rights reserved.
https://answers.yahoo.com/question/index?qid=20190518145456AArISfE
From Anonymous
enUS
Sat, 18 May 2019 14:54:56 +0000
3
Yahoo Answers: Answers and Comments for Explain why, in the worst case, the number of comparisons is of O(n^2) for the insertion sort.? [Programming & Design]
292
38
https://answers.yahoo.com/question/index?qid=20190518145456AArISfE
https://s.yimg.com/zz/combo?images/emaillogous.png

From Quentin: When a new item it inserted it has to be compa...
https://answers.yahoo.com/question/index?qid=20190518145456AArISfE
https://answers.yahoo.com/question/index?qid=20190518145456AArISfE
Sat, 18 May 2019 21:07:04 +0000
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(n1)/2 which neglecting the 1 and the factor ½ equals n^2