Computer Science 226
Algorithms and Data Structures
Spring 2008

Course Information | Assignments | Lectures | Administration


Description.   This course surveys the most important algorithms and data structures in use on computers today. Particular emphasis is given to algorithms for sorting, searching, and string processing. Fundamental algorithms in a number of other areas are covered as well, including geometric and graph algorithms. The course will concentrate on developing implementations, understanding their performance characteristics, and estimating their potential effectiveness in applications.

Instructor.   Kevin Wayne, CS 207, 258-4455, wayne@cs. Office hours: M 2-3pm, T 11-12noon, or by appointment.

Lectures.   MW 11-12:20, Frist 302. Attendance is required. You are responsible for all material presented in lecture; some of that material is not covered in the textbooks.

Precepts.   Precepts meet on Thursdays for 50 minutes. At precepts, we will return and discuss the exercises and programming assignment from the previous week. We will also give details and answer questions about the new assignment. You should come prepared to participate in the discussion, not just ask questions. Here is a list of students sorted by precept and by name.

 P01  Th 12:30 Friend 110 Moses Charikar moses@cs CS 305 T 2:30-4:30pm
 P01A  Th 12:30 Friend 007 Szymon Rusinkiewicz smr@cs CS 406 F 1-3pm
 P02  Th 1:30 Friend 007 Szymon Rusinkiewicz smr@cs CS 406 F 1-3pm
 P02A  Th 1:30 Friend 110 Moses Charikar moses@cs CS 305 T 2:30-4:30pm
 P03  Th 3:30 Friend 109 Nadia Heninger nadiah@cs CS 413 M 3-5pm

Prerequisites.   COS 126 or COS 217 or permission of instructor.

Grades.   Your grade for the course will be based on the following components: programming assignments: (45%), midterm exam: (20%), final exam: (25%), and staff discretion (10%).

Course website.   The COS 226 website is
It includes links to course content, including lecture notes, and programming assignments. You will also use it to submit programming assignments and check grades.

Course mailing list.   You can sign up for the course mailing list at

Textbooks.   The course textbooks are:

You are expected to read the books, particularly the parts that cover the same ground as lectures. They contain a wealth of information beyond what we can cover in lecture that are certain to enhance your understanding of the course material. A safe strategy is to skim through the book before lecture to get a general idea of what is to be covered, then study it carefully afterwards. While you are not responsible for reading about topics that we do not cover in lecture or that are beyond the scope of the course, you are responsible for exercising good judgment about choosing what to read.

The following is recommended for those in need of a refresher in Java programming.

Booksites.   You can find an extensive amount of supplementary information at the booksites for Introduction to Programming in Java: An Interdisciplinary Approach and the forthcoming Algorithms, 4th Edition, both by Sedgewick and Wayne.

These are intended to supplement the text. Using them is highly recommended, but is no substitute for reading the books!

Programming assignments.   There will be eight programming assignments. These involve applying the material from lecture to solve problems in science, engineering, and commerce.

Exams.   There will be an in-class midterm exam on the last lecture before break and a final exam as scheduled by the Registrar. Here is an archive of old exams.

Computers.   You may develop your programs on any machine that you like: we encourage you to use your own equipment. We provide instructions for for setting up a Java programming environment under Windows, OS X, and Linux.

Lab TA coverage.   The Princeton COS department hires undergraduate lab assistants who are available to answer general computing questions in the Friend 016 and 017 labs. Lab TAs can assist you in debugging, provided you have first made a reasonable effort to identify the bug and isolate the problem. If you have questions regarding the course material or programming assignments, see your preceptor or instructor.

Important note.   Please do not publish solutions to programming assignments in a way that could compromise their utility as pedagogical tools. At Princeton, this is a violation of the basic rights, rules and responsibilities of members of the university community.

Copyright.   All rights reserved. None of this material may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise without prior written permission. Permission is granted to instructors who adopt Algorithms in Java to use this supplemental material in conjunction with their course.

Short history of credits.   These course materials have been under development by Robert Sedgewick since at least 1978. The lecture notes and assignments were rewritten by Robert Sedgewick and Kevin Wayne in 2003-2008.