Presentation is loading. Please wait.

Presentation is loading. Please wait.

Design & Analysis of Algorithms COMP 482 / ELEC 420 John Greiner.

Similar presentations


Presentation on theme: "Design & Analysis of Algorithms COMP 482 / ELEC 420 John Greiner."— Presentation transcript:

1 Design & Analysis of Algorithms COMP 482 / ELEC 420 John Greiner

2 Math Background: Review & Beyond 1.Asymptotic notation 2.Math used in asymptotics 3.Recurrences 4.Probabilistic analysis 2 To do: [CLRS] A, B, 3.2 #1

3 Comparisons Some useful algebra:a<b, c<d implies… -b < -a 1/b < 1/a– Unless a,b have different signs! a+c < b+c ac 0 a+c b-d ! a n 0 3

4 Floor & Ceilings 4 a>0 integer a integer a>0, b 1

5 Logarithm Notation lg n = log 2 nln n = log e n lg k n = (lg n) k lg lg n = lg (lg n) lg n + k = (lg n) + k lg (0) n = nlg (i+1) n = lg lg (i) n lg* n = min {i 0 | lg (i) n 1} How many times can you take the logarithm before its 1? 5

6 Exponentials & Logarithms 6 a>0 O(log a x) = O(log b x) = O(log x) x=a c=b

7 Summations 7 Arithmetic ? Harmonic ? if |x| < 1 ? Geometric if x 1 ? Telescoping ? Solve as telescoping sum: ?

8 Summations – Combining with Calculus 8 if |x| < 1 Have: Differentiate:if |x| < 1Algebra:if |x| < 1

9 Bounding Summations: Upper Bound 9 ?

10 Bounding Summations: Lower Bound 10 ?

11 Logarithms 11

12 Bounding Summations by Integrals 12 0 1 0123 … 4 Recall: ln 1 = 0

13 Factorials n! = ω(2 n ) n! = o(n n ) log n! = Θ(n log n) 13

14 Permutations & Combinations 14 # of k-combinations of an n-set = # of permutations of an n-set = n!


Download ppt "Design & Analysis of Algorithms COMP 482 / ELEC 420 John Greiner."

Similar presentations


Ads by Google