CS 115 Lab 14, Spring 2015


Deadlines

*** THIS LAB CANNOT BE SUBMITTED LATE. ***

Goals

Upon successful completion of this lab, you should be able to trace the execution of simple recursive functions.

Pre-Lab Assignment

Click here for the pre-lab instructions.

Even if you didn't get to the pre-lab by the deadline, you should work through it before proceeding with the rest of the lab. A PDF of the pre-lab is available on Moodle.


Setup

  1. Before you start writing code, you will set up a directory for this assignment on the cwolf server. To connect to cwolf, do one of the following:
  2. Enter your CS 115 subdirectory by typing
    cd cs115
  3. Type pwd (print working directory) and verify that the output is:
    /home/student/yourusername/cs115
  4. Create a directory for Lab 14 by typing
    mkdir lab14
  5. Enter your Lab 14 directory by typing
    cd lab14
  6. Type pwd again, and verify that the output is:
    /home/student/yourusername/cs115/lab14
  7. This lab builds on Lab 10, in which you built, sorted, and searched a list of cities. Use this command to copy your Lab 10 code into the current directory and rename it to lab14b.py:
    cp ../lab10/lab10c.py lab14b.py
  8. Use this command to copy two city lists into your directory. Do not omit the '.' at the end of the command:
    cp ../lab10/*.txt ~/cs115/lab14/
  9. Type
    ls
    (that's a lowercase L followed by a lowercase S). If you followed these steps correctly, you should see the city text files and lab14b.py listed.
  10. Decide whether you want to work directly on cwolf ([remote]) or work on IDLE at your local computer ([local]), and follow the relevant instructions for the rest of the lab.
  11. [local] If you're working locally, use FileZilla to copy your Lab 14 files from cwolf to your local computer. This is the opposite of the way we normally copy files.

Lab Instructions

Follow the links below to complete each part of this lab.

  1. Recursion practice
  2. Recursive binary search
  3. Submit your code