13recurenc_equat

13recurenc_equat - Introduction to Computers and...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 13 Reading: Oct 2 2003
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Recap • Iteration versus Recursion • Towers of Hanoi • Computed time taken to solve towers of Hanoi
Background image of page 2
Divide and Conquer • It is an algorithmic design paradigm that contains the following steps Divide : Break the problem into smaller sub-problems Recur : Solve each of the sub-problems recursively Conquer : Combine the solutions of each of the sub-problems to form the solution of the problem Represent the solution using a recurrence equation
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Recurrence Equation • A recurrence equation is of the form T(n) = aT(m) + b, n > 0, m < n (induction) and T(0) = constant (base case) Where: – aT(m): cost of solving a sub-problems of size m – b: cost of pulling together the solutions
Background image of page 4
Solving Recurrence Equations •I tera t ion • Recurrence Trees • Substitution • Master Method
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Towers of Hanoi T(n) = 2 T( n-1 ) +1 1 Given: T(1) = 1 N No.Moves 1 2 3 3 7 4 15 5 31
Background image of page 6
Using Iteration T(n) = 2 T( n-1 ) +1 T(n) = 2 [ 2 T(n-2) + 1 ] +1
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

13recurenc_equat - Introduction to Computers and...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online