Computer Science 226
Algorithms and Data Structures
Fall 2008

Course Information | Assignments | Exercises | 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.

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

Instructor.   Kevin Wayne, CS 207, 258-4455, wayne@cs. Office hours: Tuesday 3-4:30, Wednesday 2:30-4, or by appointment.

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

Preceptor.   Boaz Barak, CS 405, boaz@cs. Office hours: Monday 4:30-6:30.

Precepts.   You should come to precept prepared to participate in the discussion, not just ask questions.

Grader.   Connelly Barnes, CS 214, csbarnes@cs. Office hours: Tuesday 1:30-2:30 and Wednesday 4:00-5:00.

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

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

Course mailing list.   Use the course mailing list to ask general questions about the course materials. To sign up, go to

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. 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 also find an extensive amount of supplementary information at the booksites

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.

Exercises.   There will also be weekly exercises. These will consist of short questions on the material in the lectures and readings.

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.

Labs.   We hire 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.