2008/05/12 – CS235

Sing, Prayer

Announcements

•	Review schedule
o	How is Project 2 coming?

Review

MAPS
Show << MapMore.java >>
•	Find common keys

Show << Anagrams.java >>
•	Multi-map example (multiple values per key)
•	What is an anagram? a word or phrase spelled by rearranging the letters of another word or phrase (e.g., steal, stale, and slate)
•	Input:  Dictionary.txt

Show << MultiMap.java .>>

STACK

<< StackBasics.java >>
<< Balanced.java >>

QUEUE

<< Show Countdown.java >>
<< Show PCountdown.java >>

Group Work

Lecture

Recursion – follow notes

GROUP WORK
5/12/2008

1.	Write a non-recursive program that computes the factorial of a number n.

2.	Write a non-recursive program that takes two integers, x and n, as inputs and computes x to the power of n

3.	What is recursion?

4.	Write the same two programs above using recursion:

Recursion Tips:
•	A recursive method must have a base case
•	Recursive calls generally progress towards a base case
•	Assume that the recursive call works
•	Never solve the same problem instance more than once