Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 250 September 22 - 26, 2008. A NNOUNCEMENTS No class Friday (9/26) Adrienne’s office hours cancelled 9/26 Homework 2 & 3 due 9/28.

Similar presentations


Presentation on theme: "CSE 250 September 22 - 26, 2008. A NNOUNCEMENTS No class Friday (9/26) Adrienne’s office hours cancelled 9/26 Homework 2 & 3 due 9/28."— Presentation transcript:

1 CSE 250 September 22 - 26, 2008

2 A NNOUNCEMENTS No class Friday (9/26) Adrienne’s office hours cancelled 9/26 Homework 2 & 3 due 9/28

3 R ECURSION What do we know? Base case Recursive case Wrote some methods recursively for lists – try to write them yourself as an exercise Length of list Linear search In-order insert Binary search algorithm is also commonly coded recursively – try to create it without looking at a source

4 U SES OF R ECURSION Coding these methods is useful and interesting, but for some of them, the “loops” solution is just as easy to come up with For some problems, the “loops” solution is not as easy to come up with, or the code is not very readable or elegant. Some examples: 8-queens Flood fill Game board searches (place a stone at position X, find all “matching” stones across, down, diagonally)


Download ppt "CSE 250 September 22 - 26, 2008. A NNOUNCEMENTS No class Friday (9/26) Adrienne’s office hours cancelled 9/26 Homework 2 & 3 due 9/28."

Similar presentations


Ads by Google