{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture_22

# lecture_22 - Lecture 22 Comp 116 Mar 16th 2009 Objectives...

This preview shows pages 1–9. Sign up to view the full content.

Click to edit Master subtitle style 10/6/09 Lecture 22 Comp 116 Mar 16th, 2009

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

View Full Document
10/6/09 Objectives Recursion Examples on Sorting & searching.
10/6/09 Recursion

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

View Full Document
10/6/09 Definition Definition of recursion Math: A set or function that refers back to itself Examples A(0) = 1, A(n+1) = 2 + A(n) A(0) = 2, A(1) = 3, A(n+1) = A(n) * A(n-1)
10/6/09 Definition Definition of recursion Math: A set or function that refers back to itself Computer science: a function that calls itself Example function a = A(n) if (n == 0) a = 1; else

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

View Full Document
10/6/09 Recursion – types A function can call itself self recursion A function calls another function which calls itself mutual recursion
10/6/09 Requirements Stopping condition(s) Reduction in problem size (need not decrease monotonically) Managing the variables

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

View Full Document
10/6/09 Order of operations Do work, then recurse can be easily replaced with loops Recurse, then do work.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 29

lecture_22 - Lecture 22 Comp 116 Mar 16th 2009 Objectives...

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

View Full Document
Ask a homework question - tutors are online