CSCI455 – CS 455 Lab 7: Recursion (Solution)

$ 20.99
Category:

Description

Goals and Background
Note: this lab is not done on Vocareum, and therefore there is no lab link to Vocareum from d2l; read on for how to complete it.
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 as a beginner 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 linked from the home page.
Reading and reference material
Horstmann, Chapter 13 on Recursion
CS 455 Recursion lectures (10/5 and 10/7)
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 create it, it can save the work you have already done, but I recommend just creating the account right away so you don’t forget.)
While you’re on the preferences page also enter your full name in the section for that so we know who is who.

Reviews

There are no reviews yet.

Be the first to review “CSCI455 – CS 455 Lab 7: Recursion (Solution)”

Your email address will not be published. Required fields are marked *