Professional Documents
Culture Documents
Lecture-3
Sorting Algorithms
By
Yohannes Biadgligne
• This is just the average amount of work to insert the ith element.
• Where, C(i) is the number of comparisons done in the first i passes of the for loop before we stop.
• So, how many comparisons is this?
• C(i) is given by the equation
Because N is a constant relative to i, by using Equations 1.11 and 1.14 we can get