[Instructions] [Search] [Current] [Syllabus] [Links] [Handouts] [Outlines] [Labs] [More Labs] [Assignments] [Quizzes] [Exams] [Examples] [Book] [Tutorial] [API]

Back to Algorithm Analysis. On to Recursion, Revisited.

**Held** Thursday, September 30, 1999

**Overview**

Today, we will ground our learning of recursion in Java by experimenting with two recursive functions, one that computes Fibonacci numbers and one that does exponentiation. In each case, we will consider both inefficient and more efficient versions.

**Notes**

- Don't forget tomorrow's talk!
- Note that you should not start today's lab with A1.1. Instead, skip to problem A1.3.
- Don't forget today's cool convocation talk.

**Contents**

**Handouts**

**Summary**

- Today:
- Lab A1; Recursion

- Short discussion:
- Recursive functions

- Assigned (for tomorrow):
- Lab A2: Searching

- You've studied Scheme, so you should know about recursion.
- As you've observed, it's not much different in Java.

- A recursive function is a function which calls itself, either
directly or indirectly.
- A function calls itself indirectly by calling another function which calls the original function.

- Recursion provides one mechanism for looping.
- Many mathematicians and computer scientists consider recursion significantly more elegant than for or while loops.
- The body of a typical recursive function looks like
__if__(*some-test*) {*base-*; } // base case__case____else__{*call-the-same-function-again-with-modified-parameters*; } // recursive case

Tuesday, 10 August 1999

- Created as a blank outline.

Tuesday, 28 September 1999

- Filled in the details from outline 16 of CS152 99S.
- Reformatted.

Wednesday, 29 September 1999

- Updated a few details.

Back to Algorithm Analysis. On to Recursion, Revisited.

[Instructions] [Search] [Current] [Syllabus] [Links] [Handouts] [Outlines] [Labs] [More Labs] [Assignments] [Quizzes] [Exams] [Examples] [Book] [Tutorial] [API]

**Disclaimer** Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS152/99F/Outlines/outline.21.html

Source text last modified Wed Sep 29 23:22:20 1999.

This page generated on Wed Sep 29 23:22:45 1999 by Siteweaver. Validate this page's HTML.

Contact our webmaster at rebelsky@grinnell.edu