CS35: Data Structures and Algorithms

Week 01 Lab Notes

Welcome

Welcome to CS35 Lab. This week is a little unusual in that we haven't really learned enough to start a typical CS35 lab. A typical lab session usually consists of a few small exercises or demos, followed by a short introduction to the week's lab. Afterwards, you will have time to read the lab in detail and begin working on your solutions. While we do have a short lab exercise for you this week, the focus of this lab session is configuring your CS and Swarthmore Github accounts so you can retrieve and submit code with partners, instructors, and graders.

Initial Setup

If this is your first CS course, note that the CS machines are on a different network than other campus machines hosted by ITS. Your username will be the same as your ITS login, but you will have a different password. We provide a random password for new accounts, but once you login, you can open a terminal and change it to something easier by typing the command passwd and following the prompts. If you forget your password later, you can reset it online at password.cs.swarthmore.edu.

Once you are logged in, open a browser and a terminal. For additional help on understanding the CS environment, CS students are hosting two Using Unix sessions

Additionally, we have a number of resources online for Unix help.

You are free to use any editor you want. I will tend to use either atom or vim.

Getting starter code
We are going to grab sample code and lab assignments to place in these folders using git. We'll jump over to the instructions at Lab 00 for a bit to:
  1. Create SSH keys.
  2. Log into Swarthmore Github Enterprise.
  3. Add your SSH public key to Github
  4. Configure git locally.
  5. Clone examples and lab00 repos.

Intro to C++

Instead of diving right into the lab assignment, let's clone another repo with some example programs and look at some C++ code together.
cd ~/cs35
git clone git@github.swarthmore.edu:CS35-F17/examples-<user>.git  ./examples
cd examples/week-01
We will follow the week-01 README.md to explore the code. You may (have already) explore(d) some of this in class.

Lab 00

Head back to Lab 00 and read the second half of the writeup. You are asked to individually write two small sample programs and submit them via git by Sunday night. If you have questions, feel free to ask me or a ninja for assistance. The first few labs will be individual assignments as you get practice with C++. Later in the semester, we will allow partnered labs. Introduce yourself to your neighbors and perhaps think about who you might like to work with in the future. But for this lab, you should work on your code individually and only consult with Instructors, Ninjas, Piazza, and approved web resources.

Extras

We may not have time to cover these topics in lab.

You are encouraged to configure your git profile on github. Please at least add your preferred name and email.

Practice breaking some of the example programs in controlled ways and see what error messages are generated. Recognizing common compiler error messages now will help you debug programs later as they become bigger and more complex.

Test the robustness of cin in C++. By giving invalid input. While handling all forms of user input correctly will not be a focus of this course, it is handy to know how to terminate a program that hangs. Try Ctrl-C if things get stuck.