Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms II
Advertisements

Fall 2002CMSC Discrete Structures1 Now it’s Time for… RecurrenceRelations.
Chapter 6 Advanced Counting 6.1 Recurrence Relations.
A simple example finding the maximum of a set S of n numbers.
CS 2210 (22C:19) Discrete Structures Advanced Counting
April 9, 2015Applied Discrete Mathematics Week 9: Relations 1 Solving Recurrence Relations Another Example: Give an explicit formula for the Fibonacci.
Recurrences. What is a Recurrence Relation? A system of equations giving the value of a function from numbers to numbers in terms of the value of the.
Algorithms Recurrences. Definition – a recurrence is an equation or inequality that describes a function in terms of its value on smaller inputs Example.
Induction and Recursion. Odd Powers Are Odd Fact: If m is odd and n is odd, then nm is odd. Proposition: for an odd number m, m k is odd for all non-negative.
CS Section 600 CS Section 002 Dr. Angela Guercio Spring 2010.
CSE115/ENGR160 Discrete Mathematics 04/19/12 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 04/21/11 Ming-Hsuan Yang UC Merced 1.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Recurrences The expression: is a recurrence. –Recurrence: an equation that describes a function in terms of its value on smaller functions Analysis of.
Recurrences The expression: is a recurrence. –Recurrence: an equation that describes a function in terms of its value on smaller functions BIL741: Advanced.
The Fundamentals: Algorithms, Integers, and Matrices CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Applied Discrete Mathematics Week 9: Relations
7.2 Solving Recurrence Relations. Definition 1 (p. 460)- LHRR-K Def: A linear homogeneous recurrence relations of degree k with constant coefficients.
Advanced Counting Techniques
Divide-and-Conquer 7 2  9 4   2   4   7
Jessie Zhao Course page: 1.
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
1 Recurrences Algorithms Jay Urbain, PhD Credits: Discrete Mathematics and Its Applications, by Kenneth Rosen The Design and Analysis of.
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.
14.1 CompSci 102© Michael Frank Today’s topics Recurrence relationsRecurrence relations –Stating recurrences –LiHoReCoCo –Divide & conquer –Master’s method.
Recurrence Relation. Outline  What is a recurrence relation ?  Solving linear recurrence relations  Divide-and-conquer algorithms and recurrence relations.
R. Johnsonbaugh Discrete Mathematics 7 th edition, 2009 Chapter 7 Recurrence Relations Instructor Tianping Shuai.
Module #17: Recurrence Relations Rosen 5 th ed., §
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl 1/18 Module.
Chapter 7 Advance Counting Techniques. Content Recurrence relations Generating function The principle of inclusion-exclusion.
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Recurrence.
Chapter 8 With Question/Answer Animations. Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Discrete Mathematics Recurrence Relations Chapter 5 R. Johnsonbaugh
Foundations of Discrete Mathematics Chapters 5 By Dr. Dalia M. Gil, Ph.D.
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.
CSE 2813 Discrete Structures Solving Recurrence Relations Section 6.2.
Agenda Lecture Content:  Recurrence Relations  Solving Recurrence Relations  Iteration  Linear homogenous recurrence relation of order k with constant.
Recurrence Relations. Outline Recurrence relationsSolving recurrence relationsRecurrence and Divide-and-conquer algorithmsGenerating functions
Homogeneous Linear Recurrences To solve such recurrences we must first know how to solve an easier type of recurrence relation: DEF: A linear recurrence.
The Fundamentals: Algorithms, Integers, and Matrices CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Induction and Recursion CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
Section Recursion 2  Recursion – defining an object (or function, algorithm, etc.) in terms of itself.  Recursion can be used to define sequences.
Mathematical Induction And Recursion Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Discrete Math For Computing II. Contact Information B. Prabhakaran Department of Computer Science University of Texas at Dallas Mail Station EC 31, PO.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
Introduction to Algorithms: Divide-n-Conquer Algorithms
CMSC Discrete Structures
Modeling with Recurrence Relations
Divide-and-Conquer 6/30/2018 9:16 AM
Module #17: Recurrence Relations
A Brief Summary for Exam 2
Divide-and-Conquer 7 2  9 4   2   4   7
Module #17: Recurrence Relations
Divide and Conquer Algorithms Part I
CS 2210 Discrete Structures Advanced Counting
CMSC Discrete Structures
Solving Recurrence Relations
Divide-and-Conquer 7 2  9 4   2   4   7
CMSC Discrete Structures
Introduction To Algorithms
Recurrence Relations Discrete Structures.
ICS 253: Discrete Structures I
Presentation transcript:

Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1

Recurrence Relations Konstantin Busch - LSU2 Sequence Recurrence relation: For any

Konstantin Busch - LSU3 Example: Solutions to recurrence relation: Recurrence relation

Konstantin Busch - LSU4 $10,000 bank deposit %11 interest :amount after years Example:

Konstantin Busch - LSU5 Fibonacci sequence Example:

Konstantin Busch - LSU6 Towers of HanoiExample: bar1bar2bar3 Goal: move all discs to bar3 Rule: not allowed to put larger discs on top of smaller discs discs

Konstantin Busch - LSU7 bar1bar2bar3 move recursively discs to bar2Step 1:

Konstantin Busch - LSU8 bar1bar2bar3 move largest disc to bar3Step 2:

Konstantin Busch - LSU9 bar1bar2bar3 move recursively discs to bar3Step 3:

Konstantin Busch - LSU10 :total disc moves 2 recursive calls with discs (steps 1&3) movement of largest disc (step 2) one move for one disc

Konstantin Busch - LSU11

Solving Linear Recurrence Relations Konstantin Busch - LSU12 Linear homogeneous recurrence relation of degree : Constant coefficients:

Konstantin Busch - LSU13 A sequence (solution) satisfying the relation is uniquely determined by the initial values: (these are different constants than the coefficients)

Konstantin Busch - LSU14 if an only if Solution to recurrence relation: divide both sides with characteristic equation

Konstantin Busch - LSU15 characteristic equation: factorize with roots characteristic roots: Multiple possible solutions:

Konstantin Busch - LSU16 The solutions may not satisfy the initial conditions

Konstantin Busch - LSU17 Theorem:Recurrence relation of degree 2 has unique solution where are solutions to the characteristic equation, and are constants that depend on initial conditions

Konstantin Busch - LSU18 Characteristic Equation Roots: Proof:

Konstantin Busch - LSU19 First compute from initial conditions

Konstantin Busch - LSU20

Konstantin Busch - LSU21 Prove by induction that Basis cases: true for the specific choices of

Konstantin Busch - LSU22 Inductive hypothesis: for all Inductive step: for prove that assume that

Konstantin Busch - LSU23 By inductive hypothesis:

Konstantin Busch - LSU24 By recurrence relation definition Inductive hypothesis End of Proof

Konstantin Busch - LSU25 Fibonacci sequence Example: Has solution: Characteristic roots:

Konstantin Busch - LSU26

Konstantin Busch - LSU27

Konstantin Busch - LSU28 Degree recurrence relation: has unique solution where are solutions to the characteristic equation, and are constants that depend on initial conditions

Konstantin Busch - LSU29 Example: Solution: Characteristic equation: Roots:

Konstantin Busch - LSU30 Final solution:

Recurrence Relations for Divide and Conquer Algorithms Konstantin Busch - LSU31 Typical divide and conquer algorithm: Input of size Divide into sub-problems each of size Combine sub-problems with cost

Konstantin Busch - LSU32 Divide an conquer recurrence relation: Cost of subproblem of size

Konstantin Busch - LSU33 Examples: Binary search: Merge Sort: Fast Matrix Multiplication (Stassen’s Alg.):

Konstantin Busch - LSU34 Theorem: if then

Konstantin Busch - LSU35 Proof:

Konstantin Busch - LSU36

Konstantin Busch - LSU37 End of Proof

Konstantin Busch - LSU38 Theorem: if then

Konstantin Busch - LSU39 Proof: From previous theorem

Konstantin Busch - LSU40 Case:

Konstantin Busch - LSU41 Case: End of Proof

Konstantin Busch - LSU42 Example: Binary search:

Konstantin Busch - LSU43 Master Theorem: if then

Konstantin Busch - LSU44 Example: Merge Sort:

Generating Functions Konstantin Busch - LSU45 Find number of solutions for: Answer:

Konstantin Busch - LSU46 Alternative solution choices for

Konstantin Busch - LSU47 Alternative solution is the total number of solutions to equation

Konstantin Busch - LSU48 Another problem: Find total number of solutions which satisfy:

Konstantin Busch - LSU49 Alternative solution choices for

Konstantin Busch - LSU50 Alternative solution is the total number of solutions to equation

Konstantin Busch - LSU51 Generating function: generating function for sequence

Konstantin Busch - LSU52 Solve recurrence relation Generating functions can also be used to solve recurrence relations Example:

Konstantin Busch - LSU53 Let be the generating function for sequence

Konstantin Busch - LSU54

Konstantin Busch - LSU55

Konstantin Busch - LSU56

Konstantin Busch - LSU57

Konstantin Busch - LSU58 Solution to recurrence relation

Inclusion-Exclusion Konstantin Busch - LSU59

Konstantin Busch - LSU60

Konstantin Busch - LSU61 Principle of Inclusion-Exclusion:

Konstantin Busch - LSU62 Proof: We want to prove that: an arbitrary element is counted exactly one time in the expression of the theorem

Konstantin Busch - LSU63 Suppose is a member of exactly sets: Then is counted in the terms:

is counted times Konstantin Busch - LSU64 In sum: (since belongs exactly to sets)

is counted times Konstantin Busch - LSU65 In sum: (since belongs exactly to sets)

is counted times Konstantin Busch - LSU66 In sum: (since belongs exactly to sets)

is counted times Konstantin Busch - LSU67 In sum: (since belongs exactly to sets)

Konstantin Busch - LSU68 Thus, in the expression of the theorem is counted so many times:

Konstantin Busch - LSU69 End of Proof From binomial expansion we have that: Thus, is counted exactly one time

Konstantin Busch - LSU70 Example:Find the number of primes between 1…100 If a number is composite and between 1…100 then it must be divided by a prime which is at most : 2, 3, 5, 7

Konstantin Busch - LSU71 :the set of primes between 1…100 :composites between 1…100 divided by 2 :composites between 1…100 divided by 3 :the set of composites between 1…100 :composites between 1…100 divided by 5 :composites between 1…100 divided by 7

Konstantin Busch - LSU72 From the principle of inclusion-exclusion:

Konstantin Busch - LSU73

Konstantin Busch - LSU74 Number of primes between 1…100: