CS 115 Lab 11, Spring 2015


Deadlines

Goals

Upon successful completion of this lab, you should be able to trace the execution of selection sort and bottom-up mergesort.

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 11 by typing
    mkdir lab11
  5. Enter your Lab 11 directory by typing
    cd lab11
  6. Type pwd again, and verify that the output is:
    /home/student/yourusername/cs115/lab11
  7. In this lab, you will continue to use two lists of California cities as input files. Copy this file from my cwolf directory to yours by typing the following command.
    cp ~srivoire/cs115/pickup/cities*.txt ~/cs115/lab11/
  8. Type
    ls
    (that's a lowercase L followed by a lowercase S). If you copied the files correctly, you should see cities.txt and cities-small.txt in the list.
  9. 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.
  10. If you're working locally, right-click or control-click to download these files into your default Python directory (C:\Python34 on Windows or Documents on a Mac): cities.txt and cities-small.txt. Take a look at the contents of these files, but do not make any changes to them.

Lab Instructions

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

  1. Find the minimum element of a list
  2. Selection sort
  3. Mergesort
  4. Submit your code