Presentation is loading. Please wait.

Presentation is loading. Please wait.

Quiz 1, Monday 1/28/19 Chapters 1,2 and 3 HW assignments 1-5.

Similar presentations


Presentation on theme: "Quiz 1, Monday 1/28/19 Chapters 1,2 and 3 HW assignments 1-5."— Presentation transcript:

1 Quiz 1, Monday 1/28/19 Chapters 1,2 and 3 HW assignments 1-5

2 Appendix A: Summations Sk=1 to n f(k)
Two types of summation problems in algorithms: For a given lower limit, find the function of the upper limit that the sum is equal to. a) prove by induction on integers b) transform a sum we know into the one we need 2) Find an asymptotic bound for very large values of the upper limit

3 Example: induction on integers
prove Setup to use “if S(n-1) then S(n)” inductive hypothesis application

4 Change of summation index
Example from analysis of insertion sort: use to evaluate Let k=j-1 then

5 Integration and differentiation can be used to
evaluate a sum using one you know derivative: d{ f(x)}/dx =  df/dx integral: dx {f(x)} =  dx f(x) Example: use geometric series To show k=0 to ∞ k xk = x/(1 – x)2 when 0< |x| < 1

6 Homework Assignment 6: due 1/25/19
ex A.1-3 p 1149 use derviatives on the geometric series to show that

7 Bounding sums bound sum by bounding every term Show that (n/2)2 < Sk=1 to n k < n2

8

9 Bound by integration: monotone increasing summand
Shaded area is integral of continuous function f(x) Sum equals area of “upper sum” rectangles Same f(x) different limits on integration Sum equals area of “lower sum” rectangles

10 Note the difference for monotone increasing and decreasing summand
Method not applicable if summand is not monotone increasing or decreasing

11 Use bounding by integrals for informal proof that
Sk=1 to n k-1 = Q(ln(n)) called the “harmonic” sum

12

13 Homework Assignment 7: due 1/30/19
1) Use integration to show that is bounded from above by a constant . 2)Find asymptotic upper and lower bounds on by bounding every term. Make your lower bound tighter than w(n).

14 Important sums to remember
Arithmetic k=1 to n k = n(n+1)/2 = Q(n2) Geometric k=0 to n xk = (xn+1 – 1)/(x – 1) when x  1 Harmonic k=1 to n (1/k) = ln(n) + O(1) Geometric series k=0 to ∞ xk = 1/(1 – x) when |x| < 1


Download ppt "Quiz 1, Monday 1/28/19 Chapters 1,2 and 3 HW assignments 1-5."

Similar presentations


Ads by Google