Welcome to CS 225!

Welcome to CS 225: Data Structures! In CS 225, you will be using C++ and the Linux operating system to aid your journey in becoming a master of data structures!

Getting Started with Linux

You should be familiar with the Linux command line, a useful skill not only useful for CS 225 but also for many other courses and a lot of power uses of operating systems.

If you’re on an EWS machine, you can find the Terminal app by navigating to Applications > System Tools > Terminal located at the top of your screen. (You can also drag this icon to the menu bar at the top of the screen for the future.) Finally, if you navigate to a folder using Places and right-click inside it there is an option Open In Terminal which will open the terminal. The Terminal app is the command line interface for Linux, where you run programs by typing their names, and sometimes parameters such as files to open, instead of clicking on icons and buttons.

Command Line Tutorial



and press enter. You’ll see the folder you are currently located in, called the working directory. Since you haven’t moved anywhere yet, this is your home directory.

Later on we’ll make a directory (folder) to store your coursework in, but for now, let’s create a test directory. Type the following in the terminal:

mkdir cs225test

Now let’s look at the contents of the folder we’re in (still your home directory):


You’ll probably see several folders (in blue). One of these should be cs225test/. Let’s open cs225test/:

cd cs225test/

If you type pwd again, you will see you are now in cs225test/ inside of your home directory. Finally, let’s get back to your home directory. Run one of:

cd ..
cd ~

All of them will return you to your home directory. The first (cd ..) navigates to the parent of the current working directory. The second is a shortcut builtin to cd: running cd without any parameters will navigate to your home directory. The third (cd ~) uses the ~ (a tilde), which is a standard way to say “the home directory of the current user”.

Useful Linux commands cheat sheet:

pwd             # Print Working Directory - shows the folder you are currently in

ls              # List - lists the files in your current folder

cd FOLDER       # Change Directory to FOLDER - opens FOLDER
cd ..           #  - opens the parent folder of your current location
cd              #  - opens  your home folder

atom FILE &     # Opens (or creates) FILE in atom, a text editor
gedit FILE &    # Opens (or creates) FILE in gedit, a simple text editor
vim FILE        # Opens (or creates) FILE in vim, a simple modal text editor

rm FILE         # Remove - deletes FILE
rm -r FOLDER    #        - deletes a folder and its contents
mv SRC DEST     # Move - moves/renames SRC to DEST
cp SRC DEST     # Copy - copies SRC to DEST

make PROGRAM    # Compiles PROGRAM using the rules in the Makefile file

xdg-open IMAGE  # Opens IMAGE in the default image viewer

clear           # Clear the terminal screen (Ctrl-l also works)
reset           # Reset and clear the terminal

Keyboard Shortcuts for Bash:

Ctrl + a : Navigates to the beginning of the line
Ctrl + e : Navigates to the end of the line
Alt + b  : Back (left) one word
Alt + f  : Forward (right) one word
Ctrl + u : Clears the line from the cursor to the beginning
Ctrl + c : Kills the current command being executed (useful if run into an infinite loop)
tab      : Attempts to autocomplete a command or file

More commands can be found here. Note that some of these commands may be unavailable for Mac OS X.

Check out the list above for useful Linux commands, and try using them. You can learn more by looking at the tutorials posted on the Resources page.

Checking Out the Assignment

In this class we will be using a version control system called SVN (Subversion). It is a useful tool for managing changes to source code, especially when multiple people are changing the code at the same time. In this class we use it to distribute and hand in lab and MP assignments.

SVN works similarly to a website server. You can download (check out) files, upload (commit) files, and change which files will be uploaded/downloaded (add/remove).

When files are checked out (downloaded) from the SVN repository, they are collectively referred to as the “working copy”. Like your local copy of a website, changes made to the files in the working copy only change the working copy. In order to save these changes to the SVN server, they must be committed (uploaded) to the repository.

Each student in the class is given their own personal directory in the repository. If you haven’t already, follow the instructions on the Course Setup page for checking out your directory. If you’re on EWS, you should also go through the Setup the compiler section. Then, from your SVN checkout, run

svn up

You should now have a new directory (folder) in your working directory called lab_intro containing the given files for lab_intro.

No SVN Access?

If you do not have access to SVN yet (you get a 403 Forbidden error), find a nice person sitting near you and ask to follow along.

You can download lab_intro here: lab_intro.zip.

Note you will not be able to check in these files since you did not get them from an SVN server – make sure to keep track of your files so you can upload them when you get access to the course SVN.

To open this directory, use the cd (change directory) command:

cd lab_intro/

To display the files in this directory, use the ls (list) command:

Common Coding Mistakes

Please read the specification carefully! The file names, executable names, program output, and public member functions must be named exactly as we ask. A single typo in these could result in a grade close to a zero on a MP submission. However, compiling the provided test cases will help detect these sort of typos.

Opening a Text Editor

In order to open and edit a text file, you need to open a text editor. There are hundreds of such editors and many people have a favorite one for different reasons.

There are three standard editors that work within a command line interface:

If you are writing a large program, graphical editors provide advanced features in a beginner friendly form. Some popular, free graphical editors that run on all major platforms include:

Creating a partners.txt file

For your lab assignments (not MPs), you may work with a partner! If you want to work with a partner, pair up with someone in your lab section and both of you must create a partners.txt file inside of lab_intro.

In this file, include each of your netids as one netid per line. For example:


Continue to the Lab Assignment > >