ICS 353: Design and Analysis of Algorithms

Slides:



Advertisements
Similar presentations
Appendix B Solving Recurrence Equations : With Applications to Analysis of Recursive Algorithms.
Advertisements

Algorithm : Design & Analysis [4]
CS Section 600 CS Section 002 Dr. Angela Guercio Spring 2010.
Recurrence Relations Reading Material –Chapter 2 as a whole, but in particular Section 2.8 –Chapter 4 from Cormen’s Book.
Recurrence Relations Reading Material –Chapter 2 as a whole, but in particular Section 2.8 –Chapter 4 from Cormen’s Book.
1Chapter 2. 2 Example 3Chapter 2 4 EXAMPLE 5Chapter 2.
Applied Discrete Mathematics Week 9: Relations
Analysis of Algorithms
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Do Now 1/13/12  In your notebook, list the possible ways to solve a linear system. Then solve the following systems. 5x + 6y = 50 -x + 6y = 26 -8y + 6x.
1 Computer Algorithms Lecture 7 Master Theorem Some of these slides are courtesy of D. Plaisted, UNC and M. Nicolescu, UNR.
Project 2 due … Project 2 due … Project 2 Project 2.
Chapter 8 With Question/Answer Animations 1. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Proofs, Recursion and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2.5 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Divide and Conquer Andreas Klappenecker [based on slides by Prof. Welch]
Module #17: Recurrence Relations Rosen 5 th ed., §
Chapter 2 Mathematical preliminaries 2.1 Set, Relation and Functions 2.2 Proof Methods 2.3 Logarithms 2.4 Floor and Ceiling Functions 2.5 Factorial and.
DR. NAVEED AHMAD DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF PESHAWAR LECTURE-5 Advance Algorithm Analysis.
Divide and Conquer Andreas Klappenecker [based on slides by Prof. Welch]
7.2 Solving Linear Recurrence Relations Some of these recurrence relations can be solved using iteration or some other ad hoc technique. However, one important.
Asymptotics and Recurrence Equations Prepared by John Reif, Ph.D. Analysis of Algorithms.
1Computer Sciences Department. Objectives Recurrences.  Substitution Method,  Recursion-tree method,  Master method.
Section 3.5 Solving Systems of Linear Equations in Two Variables by the Addition Method.
Divide and Conquer Faculty Name: Ruhi Fatima Topics Covered Divide and Conquer Matrix multiplication Recurrence.
Complexity of Algorithms Fundamental Data Structures and Algorithms Ananda Guna January 13, 2005.
Mathematical Analysis of Recursive Algorithm CSG3F3 Lecture 7.
1 Lecture Outline for Recurrences Already Covered: Recursive definition of sequences Recursive definition of sets Recursive definition of operations Recursive.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
CSG523/ Desain dan Analisis Algoritma
CSG523/ Desain dan Analisis Algoritma
Introduction to Algorithms: Divide-n-Conquer Algorithms
CMSC Discrete Structures
Chapter 10 Conic Sections.
6) x + 2y = 2 x – 4y = 14.
Modeling with Recurrence Relations
Introduction to the Design and Analysis of Algorithms
Proofs, Recursion and Analysis of Algorithms
Introduction to Recurrence Relations
Chapter 4: Divide and Conquer
A second order ordinary differential equation has the general form
Ch 2.1: Linear Equations; Method of Integrating Factors
Design and Analysis of Algorithms
Algorithm : Design & Analysis [4]
Module #17: Recurrence Relations
3-2: Solving Systems of Equations using Substitution
THE SUBSTITUTION METHOD
REVIEW: Solving Linear Systems by Elimination
Introduction to Algorithms 6.046J
3-2: Solving Systems of Equations using Substitution
ICS 253: Discrete Structures I
Data Structures Review Session
3-2: Solving Systems of Equations using Substitution
CS 3343: Analysis of Algorithms
Module #17: Recurrence Relations
Systems of Equations and Inequalities
Introduction to Algorithms
CMSC Discrete Structures
Solving Recurrence Relations
Divide and Conquer (Merge Sort)
CMSC Discrete Structures
3-2: Solving Systems of Equations using Substitution
Recurrence Relations Discrete Structures.
3-2: Solving Systems of Equations using Substitution
3-2: Solving Systems of Equations using Substitution
More Properties of Logarithms
ICS 353: Design and Analysis of Algorithms
ICS 253: Discrete Structures I
3-2: Solving Systems of Equations using Substitution
3-2: Solving Systems of Equations using Substitution
Presentation transcript:

ICS 353: Design and Analysis of Algorithms King Fahd University of Petroleum & Minerals Information & Computer Science Department ICS 353: Design and Analysis of Algorithms Solving Recurrence Relations

Reading Assignment Chapter 2 as a whole, but in particular Section 2.8 Chapter 4 from Cormen’s Book. Section 5: Master Method.

Outline Objective: To discuss techniques for solving recurrence relations. These techniques will be very important and “handy” tools for analyzing algorithms that are recursive. Linear Homogenous Recurrences Characteristic Equations Inhomogeneous Recurrences The Master Method Recurrence Expansion The Change of Variable Method

Linear Homogeneous Equations Definition: A recurrence relation is called linear homogeneous with constant coefficients if it is of the form: We restrict our discussion to homogeneous recurrence equations with k=1 or k=2

Solution of Linear Homogeneous Equations When k=1, and hence the solution is When k=2, the following steps are followed to solve the recurrence: Find r1 and r2, the solutions to the characteristic equation If r1 = r2 = r, then Otherwise Determine c1 and c2 from the initial values f(n0) and f(n0+1)

Examples

Inhomogeneous Equations Definition: A recurrence relation is called inhomogeneous if it is not a homogeneous recurrence relation. In particular, we will look at where i 1  i  k  gi(n) is not a constant or g0(n)  0.

Solution for Inhomogeneous Recurrences No general method for solving inhomogeneous recurrences exists. However, There are cases where a formula for a class of inhomogeneous recurrence relations exists (Master Theorem) The rest depend on experience and/or trial and error in choosing one of the following techniques Expansion Substitution Change of variable

Master Theorem Theorem: Let a1 and b>1 be constants, let g(n) be a function, and let f(n) be defined on the nonnegative integers by the recurrence where we interpret n/b to mean either n/b or n/b. Then f(n) can be bounded asymptotically as follows If >0  g(n)=O(nlogba - ), then f(n) = (nlogba). If g(n)= (nlogba), then f(n) = (nlogba log n). If >0  g(n)=(nlogba + ), and if c<1, n0  ag(n/b)  cg(n) n > n0, then f(n) = (g(n)).

Examples

Gaps in the Master Theorem The three cases in the theorem do not cover all the possibilities for g(n). There are gaps between cases 1 and 2, and 2 and 3. For example, can we apply the Master theorem on the following recurrence?

The Expansion Method When expanding few terms of some recurrences, a solution may become more apparent. Example: Consider the previous recurrence

The Change of Variables Method The idea is to change the domain of the function and define a new recurrence in the new domain whose solution may be easier to obtain or is already known. Once the solution is obtained, we convert the domain of the function back to its original domain.

Example