Presentation is loading. Please wait.

Presentation is loading. Please wait.

Design and Analysis of Algorithms Review on time complexity, “in place”, “stable” Haidong Xue Summer 2012, at GSU.

Similar presentations


Presentation on theme: "Design and Analysis of Algorithms Review on time complexity, “in place”, “stable” Haidong Xue Summer 2012, at GSU."— Presentation transcript:

1 Design and Analysis of Algorithms Review on time complexity, “in place”, “stable” Haidong Xue Summer 2012, at GSU

2 Time complexity of algorithms Execution time? – Pros: easy to obtain; Cons: not accurate Number Instructions? – Pros: very accurate; Cons: calculation is not straightforward Number of certain operations? – Pros: easy to calculate, generally accurate; Cons: not very calculate Asymptotic Notations Pros? Cons?

3 Time complexity of algorithms In the worst case for(int i=0; i> C1, C2, C3, C5 Worst case T(n) = n*C4 =  (n) Worst case T(n) = C1+C2+ C5 + n(C2+C3+C4)+ =  (n)

4 “in place” and “stable” in sorting algorithms AlgorithmWorst TimeExpected TimeExtra MemoryStable Insertion sortO(1) (in place)Can be Merge sortO(n)Can be Quick sortO(1) (in place)Can be Heap sortO(1) (in place)No Stable Not stable


Download ppt "Design and Analysis of Algorithms Review on time complexity, “in place”, “stable” Haidong Xue Summer 2012, at GSU."

Similar presentations


Ads by Google