Recursion - Discrete Mathematics - Lecture Slides, Slides for Discrete Mathematics. Islamic University of Science & Technology

Discrete Mathematics

Description: During the study of discrete mathematics, I found this course very informative and applicable.The main points in these lecture slides are:Recursion, Recursively Defined Sequences, Recurrence Relation, Tower of Hanoi, Recursive Procedure, Recursive Formula for Compound Interest, Explicit Formula, Proof by Induction, Integer Coefficients, Empty String
Showing pages  1  -  4  of  10
Recursion
Docsity.com
Recursively defined sequences
To define a sequence recursively:
give initial conditions, i.e., the values of the first
few terms explicitly;
give a recurrence relation, i.e., an equation that
relates later terms in the sequence to earlier
terms.
Example:
Define the following sequence recursively:
1, 4, 7, 10, 13, …
Solution: a1 = 1, an = an-1 + 3 for n≥2
Docsity.com
Recursion is one of the central
ideas of computer science
To solve a problem recursively
Break it down into smaller subproblems each
having the same form as the original problem;
When the process is repeated many times, the
last of the subproblems are small and easy to
solve;
The solutions of the subproblems can be woven
together to form a solution to the original problem.
Example: The tower of Hanoi
Docsity.com
RULES:
You may only move one disk at a time.
A disk may only be moved to one of the three columns.
You must never place a larger disk on top of a smaller disk.
INITIAL STATE GOAL STATE
Tower of Hanoi:
Move disks from left pole to right pole
Pole A Pole B Pole C Pole A Pole B Pole C
Docsity.com
The preview of this document ends here! Please or to read the full document or to download it.
Document information
Embed this document:
Docsity is not optimized for the browser you're using. In order to have a better experience please switch to Google Chrome, Firefox, Internet Explorer 9+ or Safari! Download Google Chrome