1 / 5

Recursion: The Real Bear Game

Recursion: The Real Bear Game. March 27, 2006. Outline. Handouts(1) Perils of JavaSchools Announcements Properties of Successful Recursive Algorithms Three Bears + 1 Box Stuffing. Successful Recursion. Has to Stop Reentrant. Three Bears + 1. X = # of bears

brody
Download Presentation

Recursion: The Real Bear Game

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Recursion: The Real Bear Game March 27, 2006

  2. Outline • Handouts(1) • Perils of JavaSchools • Announcements • Properties of Successful Recursive Algorithms • Three Bears + 1 • Box Stuffing

  3. Successful Recursion • Has to Stop • Reentrant

  4. Three Bears + 1 • X = # of bears • If X is odd, the new number of bears that you have is 3 * X + 1 • If X is even, the new number of bears that you have is X / 2. • For all X, does this sequence always converge to 1 bear?

  5. Box Stuffing • The problem is to exactly (or mostly) fit a box with sets of teddy bears. • If you have bears in sets of 1, 2, 3, 5, 10, 15, and 20, can you fit a box with the capacity of 27?

More Related