13recurenc_equat

13recurenc_equat - Introduction to Computers and...

Info icon This 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
Image of page 1

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

View Full Document Right Arrow Icon
Recap • Iteration versus Recursion • Towers of Hanoi • Computed time taken to solve towers of Hanoi
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
Image of page 3

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

View Full Document Right 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
Image of page 4
Solving Recurrence Equations • Iteration • Recurrence Trees • Substitution • Master Method
Image of page 5

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

View Full Document Right 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
Image of page 6
Using Iteration T(n) = 2 T( n-1 ) +1 T(n) = 2 [ 2 T(n-2) + 1 ] +1
Image of page 7

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern