Advanced Counting Techniques. 7.1 Recurrence Relations
|
|
- Emory Sullivan
- 5 years ago
- Views:
Transcription
1 Chapter 7 Advanced Counting Techniques 71 Recurrence Relations We have seen that a recursive definition of a sequence specifies one or more initial terms and a rule for determining subsequent terms from those that precede them A rule similar to this is called a recurrence relation Definition 1 A recurrence relation for the sequence is an equation that express terms of one or more of the previous terms of the sequence A sequence called a solution of a recurrence if it satisfies the recurrence relation Example 1 Let be a sequence that satisfies the recurrence relation for n=2,3,4,, and suppose that and What are and? Solution: Clearly =5-3=2, =2-5=-3 and so on Modeling with Recurrence Relations Example 3 Suppose that a person deposits $10,000 in a savings account at a bank yielding 11% per year with interest compound annually How much will be in the account after 30 years? Solution: Let Pn: the amount in the account after n years Then P0=10,000; P1=(111)P0, P2=111P1,, Pn=111P(n-1) That is can prove the validity of this formula We So n=30, P0=$10,000 by the formula gives us =$228,92297 Example 4 Rabbits and Fibonacci Numbers A young pair of rabbits is placed on an island A pair of rabbits does not breed until they are 2 month old After they are 2 month old, each pair of rabbits produces another pair each month Find a recurrence relation for the number of pairs of rabbits on the island after n month, assuming that no rabbits ever die 1
2 Solution: Let fn be the number of pairs of rabbits after n months We will show that fn, for n=1, 2, 3,, are the terms of the Fibonacci sequence At the end of first month, the number of pairs of rabbits f1=1 At the end of second month, the number is still f2=1, because no breeding From the third month on, after n months, the number of pairs fn is then the number of the pairs of the previous month f(n-1) plus the number of newborn pairs f(n-2), because each new born pair comes from a pair at least 2 months old So for n 3 This is of course the Fibonacci sequence Example 5 The Tower of Hanoi There is 3 pegs mounted on board together with disks of different sizes Initially these disks are placed on the first peg in order of size, with the largest on the bottom The disks are allowed to be moved one at a time from one peg to another as long as a disk is never placed on top of a smaller disk The goal is to have all the disks on the second peg in order of size, with the largest on the bottom See Figure2 Let Hn be the number of moves needed to solve the problem with n disks Set up a recurrence relation for the sequence Solution: We can transfer the top n-1 disks, by the rules, to peg 3 using H(n-1) moves See Figure3 We did not move the largest disk Now we move the largest disk to the second peg, this one move We can transfer n-1 disks on peg 3 to peg 2 using additional H(n-1) moves, placing them on top of the largest disk, which stays fixed on the bottom of peg 2 This shows that The initial condition is H1=1 Moving one disk needs one step For the rest 2
3 72 Solving Linear Recurrence Relations We study one important class of recurrence relations that express terms of a sequence as a linear combination of previous terms, which can be solved explicitly in a systematic way Definition 1 A linear homogenous recurrence relation of degree k with constant coefficients is a recurrence relation of the form an= c1an-1+ c2an-2+ + ckan-k, where c1, c2,, ck R and ck 0 Keywords: linear, homogeneous, constants- c1, c2,, ck ; degree - k Example 1 The recurrence relation Pn=(111)Pn-1 is linear, homogeneous recrel of degree one The rec rel fn=fn-1+ fn-2 is linear, homogeneous, recrel of degree 2 The rec rel an=an-5 is linear, homogeneous, recrel of degree 5 Example 2 The recurrence relation is homogeneous, degree of two, but not linear The rec rel Hn=2Hn-1+1 is linear, degree of one, but not homogeneous The rec rel Bn=nBn-1 is homogeneous, linear, degree of one, but the coefficient is not constant Solving Linear Homogeneous Recurrence Relations with Constant Coefficients We look solutions of the form for constant r is a solution of the rec rel an= c1an-1+ c2an-2+ + ckan-k The last equation is called the characteristic equation of the rec rel and the solutions of the equation is called the characteristic roots of the rec rel We treat only linear recrel of degree two Theorem 1 3
4 Let c1, c2 R Suppose that r*r- c1r- c2=0 has two real roots r1 r2 Then the sequence {an} is a solution of the recrel an= c1an-1+ c2an-2 for n=0,1, 2,, where α1 and α2 are constants Example 3 What is the solution of the recurrence relation an=an-1+2an-2 with a0=2 and a1=7? Solution: We use Theorem 1 The characteristic equation of recrel is r*r r-2=0 So the roots are r=2 and r=-1 and so the solution of the recrel is for some constant α1 and α2 From the initial condition we know that a0=2=α1 + α2, a1=7=2α1 +(-1)α2 Thus α1 = 3 and α2 =-1 Example 4 Find an explicit formula for the Fibonacci numbers Solution: Fibonacci numbers: fn= fn-1+ fn-2 and the initial conditions: f0=0 and f1=1 The treatment is similar to the Example 3 Theorem 2 Let c1, c2 R and c2 0 Suppose that r*r- c1r- c2=0 has only one root r0 Then the sequence {an} is a solution of the recrel an= c1an-1+ c2an-2 for n=0,1, 2,, where α1 and α2 are constants Example 5 What is the solution of the recurrence relation an=6an-1-9an-2 with initial conditions a0=1 and a1=6? Solution: The root to r*r-6r+9=0 is r=3 So the solution to this rec rel is for some constant α1 and α2 The rest is similar to the Example 3 4
5 Linear Non-homogeneous Recurrence Relations with Constant Coefficients A linear non-homogeneous recurrence relation with constant coefficients is a rec rel of the form an= c1an-1+ c2an-2+ + ckan-k +F(n), (E*) where c1, c2,, ck R and F(n) is a function only depends on n and not identically zero Here an= c1an-1+ c2an-2+ + ckan-k (E**) is the associated homogeneous recurrence relation Theorem 5 If is a particular solution of the recrel (E*), then every solution is the from, where is the solution of the associated rec rel (E**) Example 10 Find all solutions of the recurrence relation an=3an-1+2n What is the solution with a1=3? Solution: The associated rec rel is an=3an-1 and so the solutions are, where α1 is a constant Since F(n)=2n, so the trial solution is a linear function in n, ie, pn=nc+d So the equation an=3an-1+2n becomes nc+d=3((n-1)c+d)+2n Solving the equation we get c=-1 and d=-3/2 So the particular solution is now pn=-n-3/2 By Theorem 5, all solutions are of the form an= pn+ =-n-3/2+, where α1 is a constant With a1=3 from the general solution we get 3=-1-3/2+, so α1 =11/6 Thus an=-n-3/2+(11/6) Example 11 Find all solutions of the recurrence relation Solution: The particular solution is pn=c By the rec rel we find C=49/20 If we find the solution of associated rec rel, then the problem is solved 5
Recurrence Relations
Recurrence Relations Winter 2017 Recurrence Relations Recurrence Relations A recurrence relation for the sequence {a n } is an equation that expresses a n in terms of one or more of the previous terms
More informationCS 2210 Discrete Structures Advanced Counting. Fall 2017 Sukumar Ghosh
CS 2210 Discrete Structures Advanced Counting Fall 2017 Sukumar Ghosh Compound Interest A person deposits $10,000 in a savings account that yields 10% interest annually. How much will be there in the account
More informationCSC2100B Data Structures Analysis
CSC2100B Data Structures Analysis Irwin King king@cse.cuhk.edu.hk http://www.cse.cuhk.edu.hk/~king Department of Computer Science & Engineering The Chinese University of Hong Kong Algorithm An algorithm
More informationAdvanced Counting Techniques. Chapter 8
Advanced Counting Techniques Chapter 8 Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence Relations Nonhomogeneous Recurrence Relations Divide-and-Conquer
More informationAdvanced Counting Techniques
. All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Advanced Counting
More information6.2 SOLVING EASY RECURRENCES
Section 6.2 Solving Easy Recurrences 6.2.1 6.2 SOLVING EASY RECURRENCES We identify a type of recurrence that can be solved by special methods. def: A recurrence relation a n = f(a 0,..., a n 1 ) has degree
More informationRecurrence Relations
Recurrence Relations Recurrence Relations Reading (Epp s textbook) 5.6 5.8 1 Recurrence Relations A recurrence relation for a sequence aa 0, aa 1, aa 2, ({a n }) is a formula that relates each term a k
More informationEvery subset of {1, 2,...,n 1} can be extended to a subset of {1, 2, 3,...,n} by either adding or not adding the element n.
11 Recurrences A recurrence equation or recurrence counts things using recursion. 11.1 Recurrence Equations We start with an example. Example 11.1. Find a recurrence for S(n), the number of subsets of
More informationJong C. Park Computer Science Division, KAIST
Jong C. Park Computer Science Division, KAIST Today s Topics Introduction Solving Recurrence Relations Discrete Mathematics, 2008 2 Computer Science Division, KAIST Definition A recurrence relation for
More informationChapter 8: Recursion. March 10, 2008
Chapter 8: Recursion March 10, 2008 Outline 1 8.1 Recursively Defined Sequences 2 8.2 Solving Recurrence Relations by Iteration 3 8.4 General Recursive Definitions Recursively Defined Sequences As mentioned
More information12 Sequences and Recurrences
12 Sequences and Recurrences A sequence is just what you think it is. It is often given by a formula known as a recurrence equation. 12.1 Arithmetic and Geometric Progressions An arithmetic progression
More informationThe Fibonacci Sequence
The Fibonacci Sequence January 17, 2016 Rules: 1. Start with a pair of new rabbits born in December. 2. When the rabbits are one month old, they are considered teenagers. Teenagers cannot have children.
More information1 Recursive Algorithms
400 lecture note #8 [ 5.6-5.8] Recurrence Relations 1 Recursive Algorithms A recursive algorithm is an algorithm which invokes itself. A recursive algorithm looks at a problem backward -- the solution
More informationFibonacci Numbers. November 7, Fibonacci's Task: Figure out how many pairs of rabbits there will be at the end of one year, following rules.
Fibonacci Numbers November 7, 2010 Fibonacci's Task: Figure out how many pairs of rabbits there will be at the end of one year, following rules. Rules: 1. Start with a pair of new rabbits, born in December.
More informationFibonacci Sequence. January 19, 2014
Fibonacci Sequence January 19, 2014 Today we will learn about the Fibonacci sequence, one of the most famous sequences of numbers in mathematics. To construct it, we will look at the pattern of growth
More informationSection Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence
Section 2.4 Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations Introduction Sequences are ordered lists of elements.
More informationDefinition: A sequence is a function from a subset of the integers (usually either the set
Math 3336 Section 2.4 Sequences and Summations Sequences Geometric Progression Arithmetic Progression Recurrence Relation Fibonacci Sequence Summations Definition: A sequence is a function from a subset
More informationDiscrete Mathematics -- Chapter 10: Recurrence Relations
Discrete Mathematics -- Chapter 10: Recurrence Relations Hung-Yu Kao ( 高宏宇 ) Department of Computer Science and Information Engineering, National Cheng Kung University First glance at recurrence F n+2
More informationPart III, Sequences and Series CS131 Mathematics for Computer Scientists II Note 16 RECURRENCES
CS131 Part III, Sequences and Series CS131 Mathematics for Computer Scientists II Note 16 RECURRENCES A recurrence is a rule which defines each term of a sequence using the preceding terms. The Fibonacci
More informationSOLVING LINEAR RECURRENCE RELATIONS
SOLVING LINEAR RECURRENCE RELATIONS Schaum's outline Sec. 6.6 6.9 Rosen Sec. 8.1 8. November 9, 017 margarita.spitsakova@ttu.ee ICY0001: Lecture 8 November 9, 017 1 / 47 Contents 1 Motivation examples
More informationApplications. More Counting Problems. Complexity of Algorithms
Recurrences Applications More Counting Problems Complexity of Algorithms Part I Recurrences and Binomial Coefficients Paths in a Triangle P(0, 0) P(1, 0) P(1,1) P(2, 0) P(2,1) P(2, 2) P(3, 0) P(3,1) P(3,
More informationPage references correspond to locations of Extra Examples icons in the textbook.
Rosen, Discrete Mathematics and Its Applications, 7th edition Extra Examples Section 8. Recurrence Relations Page references correspond to locations of Extra Examples icons in the textbook. p.50, icon
More informationCOMP 555 Bioalgorithms. Fall Lecture 3: Algorithms and Complexity
COMP 555 Bioalgorithms Fall 2014 Lecture 3: Algorithms and Complexity Study Chapter 2.1-2.8 Topics Algorithms Correctness Complexity Some algorithm design strategies Exhaustive Greedy Recursion Asymptotic
More informationDivide and Conquer. Recurrence Relations
Divide and Conquer Recurrence Relations Divide-and-Conquer Strategy: Break up problem into parts. Solve each part recursively. Combine solutions to sub-problems into overall solution. 2 MergeSort Mergesort.
More informationChapter12. Relations, Functions, and Induction
. Relations. Functions. Seuences.4 Mathematical Induction.5 Recurrence Relations Chapter Review Chapter Relations, Functions, and Induction In this chapter we introduce the concepts of a relation and a
More informationLinear Recurrence Relations
Linear Recurrence Relations Linear Homogeneous Recurrence Relations The Towers of Hanoi According to legend, there is a temple in Hanoi with three posts and 64 gold disks of different sizes. Each disk
More informationDiscrete Mathematics: Logic. Discrete Mathematics: Lecture 17. Recurrence
Discrete Mathematics: Logic Discrete Mathematics: Lecture 17. Recurrence greedy algorithm greedy algorithm makes the best choice at each step (locally optimal solution) according to a specified criterion
More informationCSI2101-W08- Recurrence Relations
Motivation CSI2101-W08- Recurrence Relations where do they come from modeling program analysis Solving Recurrence Relations by iteration arithmetic/geometric sequences linear homogenous recurrence relations
More informationCSE 21 Mathematics for
CSE 21 Mathematics for Algorithm and System Analysis Motivating Create a recursive formula to specify how many ways to climb an n-stair staircase if each step covers either one or two stairsteps Summer,
More informationSection Summary. Sequences. Recurrence Relations. Summations Special Integer Sequences (optional)
Section 2.4 Section Summary Sequences. o Examples: Geometric Progression, Arithmetic Progression Recurrence Relations o Example: Fibonacci Sequence Summations Special Integer Sequences (optional) Sequences
More informationSec$on Summary. Sequences. Recurrence Relations. Summations. Ex: Geometric Progression, Arithmetic Progression. Ex: Fibonacci Sequence
Section 2.4 Sec$on Summary Sequences Ex: Geometric Progression, Arithmetic Progression Recurrence Relations Ex: Fibonacci Sequence Summations 2 Introduc$on Sequences are ordered lists of elements. 1, 2,
More informationLearning Objectives
Learning Objectives Learn about recurrence relations Learn the relationship between sequences and recurrence relations Explore how to solve recurrence relations by iteration Learn about linear homogeneous
More informationChapter 5: Sequences, Mathematic Induction, and Recursion
Chapter 5: Sequences, Mathematic Induction, and Recursion Hao Zheng Department of Computer Science and Engineering University of South Florida Tampa, FL 33620 Email: zheng@cse.usf.edu Phone: (813)974-4757
More informationDiscrete Structures Lecture Sequences and Summations
Introduction Good morning. In this section we study sequences. A sequence is an ordered list of elements. Sequences are important to computing because of the iterative nature of computer programs. The
More informationHandout 7: Recurrences (Cont d)
ENGG 2440B: Discrete Mathematics for Engineers Handout 7: Recurrences (Cont d) 2018 19 First Term Instructor: Anthony Man Cho So October 8, 2018 In the last handout, we studied techniques for solving linear
More informationSequences and Summations ICS 6D. Prof. Sandy Irani
Sequences and Summations ICS 6D Prof. Sandy Irani Test Poll What is your favorite flavor of ice cream? A) Vanilla B) Chocolate C) Moose Tracks D) Mint Chocolate Chip E) None of the above Sequences A sequence
More informationAlgorithm Analysis Recurrence Relation. Chung-Ang University, Jaesung Lee
Algorithm Analysis Recurrence Relation Chung-Ang University, Jaesung Lee Recursion 2 Recursion 3 Recursion in Real-world Fibonacci sequence = + Initial conditions: = 0 and = 1. = + = + = + 0, 1, 1, 2,
More informationAlgorithms: Background
Algorithms: Background Amotz Bar-Noy CUNY Amotz Bar-Noy (CUNY) Algorithms: Background 1 / 66 What is a Proof? Definition I: The cogency of evidence that compels acceptance by the mind of a truth or a fact.
More informationMath.3336: Discrete Mathematics. Advanced Counting Techniques
Math.3336: Discrete Mathematics Advanced Counting Techniques Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu
More informationWorksheet 1. Difference
Worksheet Differences Remember: The difference of a sequence u n is: u n u n+ u n The falling factorial (power), n to the k falling, when k > 0, is: n k n(n )... (n k + ), Please complete the following
More informationRecursion: Introduction and Correctness
Recursion: Introduction and Correctness CSE21 Winter 2017, Day 7 (B00), Day 4-5 (A00) January 25, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17 Today s Plan From last time: intersecting sorted lists and
More informationV. Adamchik 1. Recurrences. Victor Adamchik Fall of 2005
V. Adamchi Recurrences Victor Adamchi Fall of 00 Plan Multiple roots. More on multiple roots. Inhomogeneous equations 3. Divide-and-conquer recurrences In the previous lecture we have showed that if the
More informationDiscrete Mathematics. Kishore Kothapalli
Discrete Mathematics Kishore Kothapalli 2 Chapter 4 Advanced Counting Techniques In the previous chapter we studied various techniques for counting and enumeration. However, there are several interesting
More informationSolving Recurrence Relations 1. Guess and Math Induction Example: Find the solution for a n = 2a n 1 + 1, a 0 = 0 We can try finding each a n : a 0 =
Solving Recurrence Relations 1. Guess and Math Induction Example: Find the solution for a n = 2a n 1 + 1, a 0 = 0 We can try finding each a n : a 0 = 0 a 1 = 2 0 + 1 = 1 a 2 = 2 1 + 1 = 3 a 3 = 2 3 + 1
More informationCHAPTER 8 Advanced Counting Techniques
96 Chapter 8 Advanced Counting Techniques CHAPTER 8 Advanced Counting Techniques SECTION 8. Applications of Recurrence Relations 2. a) A permutation of a set with n elements consists of a choice of a first
More information5. Sequences & Recursion
5. Sequences & Recursion Terence Sim 1 / 42 A mathematician, like a painter or poet, is a maker of patterns. Reading Sections 5.1 5.4, 5.6 5.8 of Epp. Section 2.10 of Campbell. Godfrey Harold Hardy, 1877
More informationCS311H. Prof: Peter Stone. Department of Computer Science The University of Texas at Austin
CS311H Prof: Department of Computer Science The University of Texas at Austin Recurrences In how many ways can a 2 n rectangular checkerboard be tiled using 1 2 and 2 2 pieces? Good Morning, Colleagues
More informationMath 345 Intro to Math Biology Lecture 1: Biological Models using Difference Equations
Math 345 Intro to Math Biology Lecture 1: Biological Models using Difference Equations Junping Shi College of William and Mary, USA Population of James City County, Virginia Population is often recorded
More information1 Sequences and Summation
1 Sequences and Summation A sequence is a function whose domain is either all the integers between two given integers or all the integers greater than or equal to a given integer. For example, a m, a m+1,...,
More informationMI 4 Mathematical Induction Name. Mathematical Induction
Mathematical Induction It turns out that the most efficient solution to the Towers of Hanoi problem with n disks takes n 1 moves. If this isn t the formula you determined, make sure to check your data
More informationSEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION
CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION Alessandro Artale UniBZ - http://www.inf.unibz.it/ artale/ SECTION 5.6 Defining Sequences Recursively Copyright Cengage Learning. All rights reserved.
More informationCS Non-recursive and Recursive Algorithm Analysis
CS483-04 Non-recursive and Recursive Algorithm Analysis Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 4:30pm - 5:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/
More informationThe Trees of Hanoi. Joost Engelfriet
The Trees of Hanoi Joost Engelfriet Leiden Institute of Advanced Computer Science Leiden University, The Netherlands j.engelfriet@liacs.leidenuniv.nl Abstract The game of the Towers of Hanoi is generalized
More informationFibonacci numbers. Chapter The Fibonacci sequence. The Fibonacci numbers F n are defined recursively by
Chapter Fibonacci numbers The Fibonacci sequence The Fibonacci numbers F n are defined recursively by F n+ = F n + F n, F 0 = 0, F = The first few Fibonacci numbers are n 0 5 6 7 8 9 0 F n 0 5 8 55 89
More information3.3 Accumulation Sequences
3.3. ACCUMULATION SEQUENCES 25 3.3 Accumulation Sequences Overview. One of the most important mathematical ideas in calculus is that of an accumulation of change for physical quantities. As we have been
More informationAnalysis of Algorithm Efficiency. Dr. Yingwu Zhu
Analysis of Algorithm Efficiency Dr. Yingwu Zhu Measure Algorithm Efficiency Time efficiency How fast the algorithm runs; amount of time required to accomplish the task Our focus! Space efficiency Amount
More informationCS 5321: Advanced Algorithms - Recurrence. Acknowledgement. Outline. Ali Ebnenasir Department of Computer Science Michigan Technological University
CS 5321: Advanced Algorithms - Recurrence Ali Ebnenasir Department of Computer Science Michigan Technological University Acknowledgement Eric Torng Moon Jung Chung Charles Ofria Outline Motivating example:
More informationGreat Theoretical Ideas in Computer Science
15-251 Great Theoretical Ideas in Computer Science Recurrences, Fibonacci Numbers and Continued Fractions Lecture 9, September 23, 2008 Happy Autumnal Equinox http://apod.nasa.gov/apod/ap080922.html Leonardo
More informationJUST THE MATHS UNIT NUMBER 2.1. SERIES 1 (Elementary progressions and series) A.J.Hobson
JUST THE MATHS UNIT NUMBER.1 SERIES 1 (Elementary progressions and series) by A.J.Hobson.1.1 Arithmetic progressions.1. Arithmetic series.1.3 Geometric progressions.1.4 Geometric series.1.5 More general
More informationLecture 12 : Recurrences DRAFT
CS/Math 240: Introduction to Discrete Mathematics 3/1/2011 Lecture 12 : Recurrences Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last few classes we talked about program correctness. We
More informationCS 5321: Advanced Algorithms Analysis Using Recurrence. Acknowledgement. Outline
CS 5321: Advanced Algorithms Analysis Using Recurrence Ali Ebnenasir Department of Computer Science Michigan Technological University Acknowledgement Eric Torng Moon Jung Chung Charles Ofria Outline Motivating
More informationBinomial Coefficient Identities/Complements
Binomial Coefficient Identities/Complements CSE21 Fall 2017, Day 4 Oct 6, 2017 https://sites.google.com/a/eng.ucsd.edu/cse21-fall-2017-miles-jones/ permutation P(n,r) = n(n-1) (n-2) (n-r+1) = Terminology
More informationSection Summary. Definition of a Function.
Section 2.3 Section Summary Definition of a Function. Domain, Codomain Image, Preimage Injection, Surjection, Bijection Inverse Function Function Composition Graphing Functions Floor, Ceiling, Factorial
More informationFourth Lecture: 11/4
Fourth Lecture: 11/4 Definition 4.1. A sequence a n ) n=1 of complex numbers is said to be defined recursively, or to satsify a recurrence relation, if there exists a fixed k N, called the degree of the
More information2 Difference equations and modularity
2 Difference equations and modularity 2.1 Modularity: Making the input like the output 17 2.2 Endowment gift 21 2.3 Rabbits 25 The goals of this chapter are: to illustrate modularity and to describe systems
More informationCMSC 132, Object-Oriented Programming II Summer Lecture 10:
CMSC 132, Object-Oriented Programming II Summer 2016 Lecturer: Anwar Mamat Lecture 10: Disclaimer: These notes may be distributed outside this class only with the permission of the Instructor. 10.1 RECURSION
More informationRecurrences COMP 215
Recurrences COMP 215 Analysis of Iterative Algorithms //return the location of the item matching x, or 0 if //no such item is found. index SequentialSearch(keytype[] S, in, keytype x) { index location
More informationWhy do we need math in a data structures course?
Math Review 1 Why do we need math in a data structures course? To nalyze data structures and algorithms Deriving formulae for time and memory requirements Will the solution scale? Quantify the results
More informationThe Golden Ratio. The Divine Proportion
The Golden Ratio The Divine Proportion The Problem There is a population of rabbits for which it is assumed: 1) In the first month there is just one newborn pair 2) New-born pairs become fertile from their
More informationDYNAMICAL SYSTEMS
0.42 DYNAMICAL SYSTEMS Week Lecture Notes. What is a dynamical system? Probably the best way to begin this discussion is with arguably a most general and yet least helpful statement: Definition. A dynamical
More information6.042/18.062J Mathematics for Computer Science March 17, 2005 Srini Devadas and Eric Lehman. Recurrences
6.04/8.06J Mathematics for Computer Science March 7, 00 Srini Devadas and Eric Lehman Lecture Notes Recurrences Recursion breaking an object down into smaller objects of the same type is a major theme
More informationCS Analysis of Recursive Algorithms and Brute Force
CS483-05 Analysis of Recursive Algorithms and Brute Force Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 4:30pm - 5:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/
More informationAlgoritmi di Bioinformatica. Computational efficiency I
Algoritmi di Bioinformatica Zsuzsanna Lipták Laurea Magistrale Bioinformatica e Biotechnologie Mediche (LM9) a.a. 2014/15, spring term Computational efficiency I 2 / 18 Computational Efficiency As we will
More informationSequences and Series. Copyright Cengage Learning. All rights reserved.
Sequences and Series Copyright Cengage Learning. All rights reserved. 12.1 Sequences and Summation Notation Copyright Cengage Learning. All rights reserved. Objectives Sequences Recursively Defined Sequences
More informationUCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis
UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis Lecture 14 Class URL: http://vlsicad.ucsd.edu/courses/cse21-s14/ Lecture 14 Notes Goals for this week Big-O complexity
More informationChapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60
MATH 213 Chapter 2: Basic Structures Dr. Eric Bancroft Fall 2013 Dr. Eric Bancroft MATH 213 Fall 2013 1 / 60 Chapter 2 - Basics Structures 2.1 - Sets 2.2 - Set Operations 2.3 - Functions 2.4 - Sequences
More informationChapter 2 - Basics Structures
Chapter 2 - Basics Structures 2.1 - Sets Definitions and Notation Definition 1 (Set). A set is an of. These are called the or of the set. We ll typically use uppercase letters to denote sets: S, A, B,...
More informationCHAPTER 4 SOME METHODS OF PROOF
CHAPTER 4 SOME METHODS OF PROOF In all sciences, general theories usually arise from a number of observations. In the experimental sciences, the validity of the theories can only be tested by carefully
More informationCOMPSCI 105 S Principles of Computer Science. Recursion 2
COMPSCI 105 S2 2014 Principles of Computer Science Recursion 2 Exercise } We can determine how many digits a positive integer has by repeatedly dividing by 10 (without keeping the remainder) until the
More informationLogic and Discrete Mathematics. Section 6.7 Recurrence Relations and Their Solution
Logic and Discrete Mathematics Section 6.7 Recurrence Relations and Their Solution Slides version: January 2015 Definition A recurrence relation for a sequence a 0, a 1, a 2,... is a formula giving a n
More informationThe Principle of Linearity applications in the areas of algebra and analysis
Proseminar Mathematisches Problemlösen University of Karlsruhe SS 6 The Principle of Linearity applications in the areas of algebra and analysis Franziska Häfner Contents Converting complex problems into
More information8. Sequences, Series, and Probability 8.1. SEQUENCES AND SERIES
8. Sequences, Series, and Probability 8.1. SEQUENCES AND SERIES What You Should Learn Use sequence notation to write the terms of sequences. Use factorial notation. Use summation notation to write sums.
More informationMathematical Fundamentals
Mathematical Fundamentals Sets Factorials, Logarithms Recursion Summations, Recurrences Proof Techniques: By Contradiction, Induction Estimation Techniques Data Structures 1 Mathematical Fundamentals Sets
More informationGreat Theoretical Ideas in Computer Science
15-251 Great Theoretical Ideas in Computer Science Recurrences, Fibonacci Numbers and Continued Fractions Lecture 9, September 24, 2009 Leonardo Fibonacci In 1202, Fibonacci proposed a problem about the
More informationLecture 8 : Structural Induction DRAFT
CS/Math 240: Introduction to Discrete Mathematics 2/15/2011 Lecture 8 : Structural Induction Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last week we discussed proofs by induction. We
More informationLecture 2. Fundamentals of the Analysis of Algorithm Efficiency
Lecture 2 Fundamentals of the Analysis of Algorithm Efficiency 1 Lecture Contents 1. Analysis Framework 2. Asymptotic Notations and Basic Efficiency Classes 3. Mathematical Analysis of Nonrecursive Algorithms
More informationRecursion and Induction
Recursion and Induction Themes Recursion Recurrence Definitions Recursive Relations Induction (prove properties of recursive programs and objects defined recursively) Examples Tower of Hanoi Gray Codes
More informationcse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska
cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska LECTURE 1 INTRODUCTION Course Web Page www.cs.stonybrook.edu/ cse547 The webpage contains: detailed lectures notes slides; very detailed
More informationIntermediate Math Circles March 11, 2009 Sequences and Series
1 University of Waterloo Faculty of Mathematics Centre for Education in Mathematics and Computing Intermediate Math Circles March 11, 009 Sequences and Series Tower of Hanoi The Tower of Hanoi is a game
More informationEx. Here's another one. We want to prove that the sum of the cubes of the first n natural numbers is. n = n 2 (n+1) 2 /4.
Lecture One type of mathematical proof that goes everywhere is mathematical induction (tb 147). Induction is essentially used to show something is true for all iterations, i, of a sequence, where i N.
More informationCOMPUTER ALGORITHMS. Athasit Surarerks.
COMPUTER ALGORITHMS Athasit Surarerks. Introduction EUCLID s GAME Two players move in turn. On each move, a player has to write on the board a positive integer equal to the different from two numbers already
More informationor the number of bacteria in a colony after each hour, if the colony starts with one bacteria and each bacteria divides into two every hour
448 Sequences and Series In everyday life, we can observe sequences or series of events in many contexts. For instance, we line up to enter a store in a sequence, we make a sequence of mortgage payments,
More informationHomework Gots to be Typeset. We Are Here to help! Dominoes. Inductive Reasoning Lecture 2 (January 19, 2006)
Homework Gots to be Typeset You may use any typesetting program you wish, but we strongly encourage you to use LaTeX We Are Here to help! There are many office hours throughout the week If you have problems
More informationCpt S 223. School of EECS, WSU
Math Review 1 Why do we need math in a data structures course? To nalyze data structures and algorithms Deriving formulae for time and memory requirements Will the solution scale? Quantify the results
More informationMath Circle: Recursion and Induction
Math Circle: Recursion and Induction Prof. Wickerhauser 1 Recursion What can we compute, using only simple formulas and rules that everyone can understand? 1. Let us use N to denote the set of counting
More informationSequences and Series. College Algebra
Sequences and Series College Algebra Sequences A sequence is a function whose domain is the set of positive integers. A finite sequence is a sequence whose domain consists of only the first n positive
More informationDesign Patterns for Data Structures. Chapter 3. Recursive Algorithms
Chapter 3 Recursive Algorithms Writing recurrences + Writing recurrences To determine the statement execution count is a two-step problem. Write down the recurrence from the recursive code for the algorithm.
More information15 DIFFERENCE EQUATIONS 2
5 DIFFERENCE EQUATIONS 2 Chapter 5 Difference Equations 2 Objectives After studying this chapter you should be able to obtain the solution of any linear homogeneous second order difference equation; be
More informationFrom M&Ms to Mathematics, or, How I learned to answer questions and help my kids love math.
From M&Ms to Mathematics, or, How I learned to answer questions and help my kids love math. Steven J. Miller, Williams College sjm1@williams.edu, Steven.Miller.MC.96@aya.yale.edu (with Cameron and Kayla
More informationGreat Theoretical Ideas in Computer Science
15-251 Great Theoretical Ideas in Computer Science 15-251 Proof Techniques for Computer Scientists Induction Inductive Reasoning Lecture 2 (August 28, 2008) This is the primary way we ll 1. prove theorems
More information