Recursion+posted - Intro to Recursion Consider...

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

View Full Document Right Arrow Icon
Intro to Recursion Consider problems/tasks that are parametrized by an integer Computing the factorial of a number n Computing the eigenvalues of an n-by-n matrix Computing the determinant of an n-by-n matrix Assume that For any k , the solution for the case n=k+1 can be written very clearly in terms of the solutio for the n=k case, and… Solution for n=0 case is “obvious” Then, a recursive strategy can be used to solve the problem for any value of n. A program is recursive if it calls itself.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Intro to Recursion Assume that For any k , the solution for the case n=k+1 can be written very clearly in terms of the solution for the n=k case, and… Solution for n=0 case is “obvious” Then, a recursive strategy can be used to solve the problem for any value of n. 1. Complex (level 3) problem, “I don’t think I know how to solve this” 2. Reduce problem “1-level” through a clever step 1. Complex (level 2) problem, “I don’t think I know how to solve this” 2. Reduce problem “1-level” through a clever step 1. Complex (level 1) problem, “I don’t think I know how to solve this” 2. Reduce problem “1-level” through a clever step 1. Simple (level 0) problem, “I know how to solve this” 2. Solve level-0 problem 3.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/14/2010 for the course E 7 taught by Professor Patzek during the Summer '08 term at University of California, Berkeley.

Page1 / 13

Recursion+posted - Intro to Recursion Consider...

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

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