$24
Goals and Background
This lab is for you to practice writing recursive code. Each of the problems are small problems that you would probably not normally write recursively, but that are easy enough so you can apply the idea of "thinking recursively" and turn it into working code. Writing such code recursively will help you to be able to solve more complicated problems recursively; i.e., ones that would be much more difficult or complicated to solve without recursion.
Thus to get the lab point on these problems, you not only have to get the code to work, but you have to solve it recursively, and follow the other specifications of the problem (two of them are problems that we also discussed in the recursion lecture, but that we will be doing a different way for the lab).
For this lab we will be using the website codingbat.com This very useful website, created by my colleague Nick Parlante at Stanford, has lots and lots of Java practice problems with a way to compile and test individual methods stand-alone right on the web page. (By the way, there is also a link to this website from our Sample Exams page, as a useful resource for more practice exam problems).
If you are wondering why it has the name Codingbat, read near the bottom of the "About" page on the website.
Reading and reference material
Horstmann, Chapter 13 on Recursion
CS 455 Recursion lectures (2/19 and 2/21)
Exercises 1,2, and 3 (1 checkoff point each)
Note: if you want to save your code beyond your lab session (e.g., to look at it or work on it more later), you should create an account in codingbat. I recommend you do this in case you somehow have to leave your session or get disconnected before you complete your lab and get it checked off. DEN students must create a codingbat account and share it with us for us to be able to see that you have completed the lab. Please read the DEN section below and follow the directions there before starting your lab.
One point for each of the problems linked from the following web page. Each problem is described on its problem page:
Recursion Lab Codingbat page
Codingbat is pretty self-explanatory, but for more information, on each codingbat problem page there is a link to a help page at the top right of the page. Reading the first section of that help page should be enough to get you started. Also, at the bottom of each problem page there is a link labeled Java Example Solution Code. That solution page includes an example solved recursion problem in a section labeled Recursion.
Checkoff for DEN students
As mentioned above, you must create your own account in codingbat to be able to save your work. Please use your USC email address as the account name to make it easy to identify you. (If you start your work and then
bytes.usc.edu/cs455/curr/labs/lab7/lab7.html 1/2
CSCI 455: Lab 7
created it, it can save the work you have already done, but I recommend just creating the account right away so you don't forget.)
So we can access the code you wrote for your lab, you (DEN students) will need to share your account with lab TA's account. How to do this: once you have an account there's a preferences (prefs) link at the top right of the page. On the preferences page enter the following account usccsci455@gmail.com in the Teacher Share section. While you're on the preferences page also enter your full name in the section for that so we know who is who.
bytes.usc.edu/cs455/curr/labs/lab7/lab7.html 2/2