Math Background: Review & Beyond. Design & Analysis of Algorithms COMP 482 / ELEC 420. Solving for Closed Forms. Obtaining Recurrences

Similar documents
CS103A Handout 23 Winter 2002 February 22, 2002 Solving Recurrence Relations

SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES

Soving Recurrence Relations

Project Deliverables. CS 361, Lecture 28. Outline. Project Deliverables. Administrative. Project Comments

S. Tanny MAT 344 Spring be the minimum number of moves required.

Basic Elements of Arithmetic Sequences and Series

Infinite Sequences and Series

Incremental calculation of weighted mean and variance

1 Correlation and Regression Analysis

Sequences and Series

Math 113 HW #11 Solutions

Lesson 15 ANOVA (analysis of variance)

Properties of MLE: consistency, asymptotic normality. Fisher information.

Asymptotic Growth of Functions


Factoring x n 1: cyclotomic and Aurifeuillian polynomials Paul Garrett <garrett@math.umn.edu>

where: T = number of years of cash flow in investment's life n = the year in which the cash flow X n i = IRR = the internal rate of return

SAMPLE QUESTIONS FOR FINAL EXAM. (1) (2) (3) (4) Find the following using the definition of the Riemann integral: (2x + 1)dx

1. MATHEMATICAL INDUCTION

CHAPTER 3 THE TIME VALUE OF MONEY

Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

THE REGRESSION MODEL IN MATRIX FORM. For simple linear regression, meaning one predictor, the model is. for i = 1, 2, 3,, n

FIBONACCI NUMBERS: AN APPLICATION OF LINEAR ALGEBRA. 1. Powers of a matrix

1. C. The formula for the confidence interval for a population mean is: x t, which was

In nite Sequences. Dr. Philippe B. Laval Kennesaw State University. October 9, 2008

Inference on Proportion. Chapter 8 Tests of Statistical Hypotheses. Sampling Distribution of Sample Proportion. Confidence Interval

3. Greatest Common Divisor - Least Common Multiple

5 Boolean Decision Trees (February 11)

Running Time ( 3.1) Analysis of Algorithms. Experimental Studies ( 3.1.1) Limitations of Experiments. Pseudocode ( 3.1.2) Theoretical Analysis


CS103X: Discrete Structures Homework 4 Solutions

Determining the sample size

CME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 8

Solutions to Selected Problems In: Pattern Classification by Duda, Hart, Stork

Trigonometric Form of a Complex Number. The Complex Plane. axis. ( 2, 1) or 2 i FIGURE The absolute value of the complex number z a bi is

Notes on exponential generating functions and structures.

Section 11.3: The Integral Test

Lesson 17 Pearson s Correlation Coefficient

Systems Design Project: Indoor Location of Wireless Devices

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 13

Lecture 4: Cauchy sequences, Bolzano-Weierstrass, and the Squeeze theorem

Solving Logarithms and Exponential Equations

Lecture 2: Karger s Min Cut Algorithm

Lecture 13. Lecturer: Jonathan Kelner Scribe: Jonathan Pines (2009)

University of California, Los Angeles Department of Statistics. Distributions related to the normal distribution

A Recursive Formula for Moments of a Binomial Distribution

1 Computing the Standard Deviation of Sample Means

5.3. Generalized Permutations and Combinations

Example 2 Find the square root of 0. The only square root of 0 is 0 (since 0 is not positive or negative, so those choices don t exist here).

. P. 4.3 Basic feasible solutions and vertices of polyhedra. x 1. x 2

Time Value of Money. First some technical stuff. HP10B II users

I. Chi-squared Distributions

5.4 Amortization. Question 1: How do you find the present value of an annuity? Question 2: How is a loan amortized?

Convexity, Inequalities, and Norms

BINOMIAL EXPANSIONS In this section. Some Examples. Obtaining the Coefficients

Chapter 5: Inner Product Spaces

Chapter 6: Variance, the law of large numbers and the Monte-Carlo method

A Faster Clause-Shortening Algorithm for SAT with No Restriction on Clause Length

.04. This means $1000 is multiplied by 1.02 five times, once for each of the remaining sixmonth

FOUNDATIONS OF MATHEMATICS AND PRE-CALCULUS GRADE 10

5: Introduction to Estimation

2-3 The Remainder and Factor Theorems

Chapter 14 Nonparametric Statistics

Listing terms of a finite sequence List all of the terms of each finite sequence. a) a n n 2 for 1 n 5 1 b) a n for 1 n 4 n 2

Lecture 3. denote the orthogonal complement of S k. Then. 1 x S k. n. 2 x T Ax = ( ) λ x. with x = 1, we have. i = λ k x 2 = λ k.

The following example will help us understand The Sampling Distribution of the Mean. C1 C2 C3 C4 C5 50 miles 84 miles 38 miles 120 miles 48 miles

Confidence Intervals for One Mean

Concept: Types of algorithms

THE ARITHMETIC OF INTEGERS. - multiplication, exponentiation, division, addition, and subtraction

Our aim is to show that under reasonable assumptions a given 2π-periodic function f can be represented as convergent series

CHAPTER 7: Central Limit Theorem: CLT for Averages (Means)

Chapter 7: Confidence Interval and Sample Size

SEQUENCES AND SERIES CHAPTER

A Guide to the Pricing Conventions of SFE Interest Rate Products

CURIOUS MATHEMATICS FOR FUN AND JOY

Chatpun Khamyat Department of Industrial Engineering, Kasetsart University, Bangkok, Thailand

Hypothesis testing. Null and alternative hypotheses

Confidence Intervals. CI for a population mean (σ is known and n > 30 or the variable is normally distributed in the.

Descriptive Statistics

Chair for Network Architectures and Services Institute of Informatics TU München Prof. Carle. Network Security. Chapter 2 Basics

Output Analysis (2, Chapters 10 &11 Law)

*The most important feature of MRP as compared with ordinary inventory control analysis is its time phasing feature.

Overview. Learning Objectives. Point Estimate. Estimation. Estimating the Value of a Parameter Using Confidence Intervals

NATIONAL SENIOR CERTIFICATE GRADE 12

Research Article Sign Data Derivative Recovery

THE LEAST COMMON MULTIPLE OF A QUADRATIC SEQUENCE

Factors of sums of powers of binomial coefficients

Chapter 5 Unit 1. IET 350 Engineering Economics. Learning Objectives Chapter 5. Learning Objectives Unit 1. Annual Amount and Gradient Functions

The Stable Marriage Problem

Chapter 7 - Sampling Distributions. 1 Introduction. What is statistics? It consist of three major areas:

THE ABRACADABRA PROBLEM

Solving equations. Pre-test. Warm-up

4.3. The Integral and Comparison Tests

Repeating Decimals are decimal numbers that have number(s) after the decimal point that repeat in a pattern.

A probabilistic proof of a binomial identity

Math 114- Intermediate Algebra Integral Exponents & Fractional Exponents (10 )

One-sample test of proportions

Multiple Representations for Pattern Exploration with the Graphing Calculator and Manipulatives

TO: Users of the ACTEX Review Seminar on DVD for SOA Exam MLC

Detecting Voice Mail Fraud. Detecting Voice Mail Fraud - 1

Transcription:

Math Backgroud: Review & Beyod. Asymptotic otatio Desig & Aalysis of Algorithms COMP 48 / ELEC 40 Joh Greier. Math used i asymptotics 3. Recurreces 4. Probabilistic aalysis To do: [CLRS] 4 # T() = O() = T() = 4T(/) + k > Obtaiig Recurreces Itroductory multiplicatio examples: T () = O() = T () = 3T (/) + k > Obtaied from straightforward readig of algorithms. T() = O() = T() = 4T(/) + k > Solvig for Closed Forms T () = O() = T () = 3T (/) + k > log T Θ 3 T' Θ Key observatio: Determiistic algorithms lead to recurreces.. Determie appropriate metric for the size.. Examie how metric chages durig recursio/iteratio. How? I geeral, hard. Solutios ot always kow. Will discuss techiques i a few miutes 3 4 Recurreces Base Case Recurreces T() = 4T(/) + k > T () = 3T (/) + k > T() = O() T() = <b b For costat-sized problems, ca boud algorithm by some costat. This costat is irrelevat for asymptote. Ofte skip writig base case.? What if is odd Next iteratio, is ot itegral. Nosese. T() = 3T(/) + T(/) + k > Above more accurate. The differece rarely matters, so usually igore this detail. 5 6

Two Commo Forms of Recurreces Techiques for Solvig Recurreces Divide-ad-coquer: T() = at(/b) + f() b Substitutio Recursio Tree Master Method for divide & coquer Liear: T() = a T(-)+a T(-) + f() >b Summatio Characteristic Equatio for simple liear for liear 7 8 Techiques: Substitutio Substitutio Example Guess a solutio & check it. Simplified versio of previous example. More detail:. Guess the form of the solutio, usig ukow costats.. Use iductio to fid the costats & verify the solutio. Completely depedet o makig reasoable guesses. T() = O( 3 ). More specifically: T() c 3, for all large eough. 9 0 Substitutio Example Substitutio Example T() c 3 for > 0 T() c 3 for > 0 Prove by strog iductio o. Which meas what exactly? Assume T(k) ck 3 for k> 0, for k<. Show T() c 3 for > 0. Base case, = 0 +: Assume: T(k) ck 3 for k> 0, for k<. Show: T() c 3 for > 0. Awkward. Fortuately, 0 =0 works i these examples.

Substitutio Example Substitutio Example T() c 3 T() c 3 Assume T(k) ck 3, for k<. Show T() c 3. Assume T(k) ck 3, for k<. Show T() c 3. Base case, =: T() = Defiitio. c Choose large eough c for coclusio. Iductive case, >: T() = 4T(/) + Defiitio. 4c(/) 3 + Iductio. = c/ 3 + Algebra. 3 While this is O( 3 ), we re ot doe. Need to show c/ 3 + c 3. Fortuately, the costat factor is shrikig, ot growig. 4 Substitutio Example Substitutio Example T() c 3 Assume T(k) ck 3, for k<. Show T() c 3. Iductive case, >: T() c/ 3 + From before. = c 3 - (c/ 3 - ) Algebra. c 3 For >0, if c. Proved: T() 3 for >0 Thus, T() = O( 3 ). 5 6 Substitutio Example Substitutio Example T() c for > 0 T() = O( ). Same recurrece, but ow try tighter boud. More specifically: T() c for > 0. Follow same steps, ad we get... Assume T(k) ck, for k<. Show T() c. T() = 4T(/) + 4c(/) + = c + Not c! Problem is that the costat is t shrikig. 7 8 3

Substitutio Example Substitutio Example T() c - d Solutio: Use a tighter guess & iductive hypothesis. Subtract a lower-order term a commo techique. T() c - d for >0 Assume T(k) ck - d, for k<. Show T() c - d. Base case, =: T() = Defiitio. c-d Choosig c, d appropriately. Assume T(k) ck - dk, for k<. Show T() c - d. 9 0 Substitutio Example Substitutio Example T() c - d Assume T(k) ck - d, for k<. Show T() c - d. Iductive case, >: T() = 4T(/) + Defiitio. 4(c(/) - d(/)) + Iductio. = c - d + Algebra. = c - d - (d - ) Algebra. c - d Choosig d. Proved: T() for >0 Thus, T() = O( ). Techiques: Recursio Tree Recursio Tree Example Guessig correct aswer ca be difficult! Need a way to obtai appropriate guess. How may levels?. Uroll recurrece to obtai a summatio.. Solve or estimate summatio. Math sometimes tricky. T() / / / / /4 /4 /4 /4 /4 /4 /4 /4 4 log Now, tur picture ito a summatio 3. Use solutio as a guess i substitutio. 4 #levels 3 I this example, all terms o a level are the same. Commo, but ot always true. 4 4

Recursio Tree Example Recursio Tree Example lg i T() i0 T() = T(/3) + T(/3) + > How may levels? / T() / / / /4 /4 /4 /4 /4 /4 /4 /4 4 4 lg lg lg lg T() /3 /3 /9 /9 /9 4/9 log 3/ But, ot all braches have same depth! Makes cost ear the leaves hard to calculate. Estimate! T() = + + 4 + + lg + 4 lg = Θ( ) = ( + + 4 + + lg ) + lg 4 5 6 Recursio Tree Example Recursio Tree Example T() = T(/3) + T(/3) + > T() = T(/3) + T(/3) + > T() T() /3 /3 /9 /9 /9 4/9 Overestimate. Cosider all braches to be of max depth. T() (log 3/ - ) + T() = O( log ) /3 /3 /9 /9 /9 4/9 Uderestimate. Cout the complete levels, & igore the rest. T() (log 3 ) T() = Ω( log ) #levels = log 3/ #levels = log 3 Thus, T() = Θ( log ) 7 8 Techiques: Master Method Cookbook solutio for may recurreces of the form T() = a T(/b) + f() where a, b>, f() asymptotically positive Master Method Case T() = a T(/b) + f() f() = O( logb a - ) for some >0 T() = Θ( logb a ) T() = 7T(/) + c a=7, b= E.g., Strasse matrix multiplicatio. First describe its cases, the outlie proof. c =? O( logb a - ) = O( log 7 - ) O(.8 - ) Yes, for ay 0.8. T() = Θ( lg 7 ) 9 30 5

Master Method Case T() = a T(/b) + f() f() = Θ( logb a ) T() = Θ( logb a lg ) T() = T(/) + c a=, b= E.g., mergesort. c =? Θ( logb a ) = Θ( log ) = Θ() Yes. Master Method Case 3 T() = a T(/b) + f() f() = Ω( logb a + ) for some >0 ad af(/b) cf() for some c< ad all large eough T() = Θ(f()) T() = 4T(/) + 3 a=4, b= 3 =? Ω( logb a + ) = Ω( log 4 + ) = Ω( + ) Yes, for ay. I.e., is the costat factor shrikig? T() = Θ( lg ) 4(/) 3 = ½ 3? c 3 Yes, for ay c ½. T() = Θ( 3 ) 3 3 Master Method Case 4 Master Method Case 4 T() = a T(/b) + f() T() = a T(/b) + f() Noe of previous apply. Master method does t help. Noe of previous apply. Master method does t help. T() = 4T(/) + /lg a=4, b= T() = 4T(/) + /lg a=4, b= Case? /lg =? O( logb a - ) = O( log 4 - ) = O( - ) = O( / ) Case? /lg =? Θ( logb a ) = Θ( log 4 ) = Θ( ) No, sice lg is asymptotically <. Thus, /lg is asymptotically > /. 33 No. 34 Master Method Case 4 Master Method Proof Outlie T() = a T(/b) + f() Noe of previous apply. Master method does t help. T() = 4T(/) + /lg a=4, b= Case 3? /lg =? Ω( logb a + ) = Ω( log 4 + ) = Ω( + ) T() = a T(/b) + f() T() f() f() /b /b af(/b) /b /b /b /b a f(/b ) a #levels How may levels? log b T log b i a f / b i0 logba i No, sice /lg is asymptotically <. Cases correspod to determiig which term domiates & how to compute sum. 35 36 6

Techique: Summatio For liear recurreces with oe recursive term. Techiques: Characteristic Equatio Applies to liear recurreces T() = T(-) + f()? Homogeous: a = c a - + c a - + + c k a -k T() = T(-) + f()? Nohomogeous: a = c a - + c a - + + c k a -k + F() 37 38 7