Christos Papadimitriou (christos AT cs.berkeley)
LECTURES: TuTh 11-12:30P
OFFICE HOURS: Mon Thurs 5-6 pm, 689 Soda

Steven Houston (shouston AT eecs.berkeley)
Henry Lin (henrylin AT eecs.berkeley)
Barret Rhoden (brho AT eecs.berkeley)
David Tung (dbtung AT eecs.berkeley)

101Wed 10:00-11:009 EvansHenry
102Wed 11:00-12:009 EvansDavid
105Wed 13:00-14:0085 EvansBarret
103Wed 15:00-16:00241 CorySteven
104Wed 16:00-17:0085 EvansSteven
106Wed 17:00-18:002 EvansDavid

Steven Houston: Monday 12:00-13:00 and Tuesday 14:00-15:00, Soda 751 (Alcove)
Henry Lin: Thursday 14:00-15:00, Soda 511 (Alcove)
Barret Rhoden: Monday 13:30-14:30 and Friday 14:30-15:30, Soda 511 (Alcove)
David Tung: Thursday 15:00-16:00 and Friday 13:00-14:00, Soda 511 (Alcove)



The textbook for this course is "Algorithms" by Dasgupta, Papadimitriou & Vazirani. You can also access the material online at Algorithms but be aware that it is a slightly different version and exercise numbers may not agree. HW assignments refer to exercise numbers in the printed version.


Lesson #





August 28

Introduction and overview

Chapter 0

2, 3

August 30, September 4

Arithmetic, primality, RSA

Chapter 1.1-1.4


September 6

RSA, Hashing

Chapter 1.4-1.5

5, 6

September 11, 13


Chapter 2.1-2.5

7, 8

September 18, 20

Fast Fourier transform

Chapter 2.6

9, 10

September 25, 27

Graph search

Chapter 3

11, 12

October 2, 4

Shortest paths

Chapter 4


October 9

Midterm 1


14, 15, 16

October 11, 16, 18

Spanning trees and greedy algorithms

Chapter 5

17, 18, 19

October 23, 25, 30

Dynamic programming

Chapter 6

20, 21, 22

November 1, 6, 8

Linear Programming

Chapter 7


November 13

Midterm 2


24, 25

November 15, 20


Chapter 8

26, 27

November 27, 29

Coping with NP-completeness

Chapter 9

28, 29

December 4, 6

Quantum algorithms

Chapter 10



All homeworks are due at 5 PM Tuesday in the Soda 283 HW Box, unless otherwise stated. Please staple all sheets together and ensure that each sheet is labeled with your name, SID number, section number, and "CS170--Fall 2007". You risk receiving no credit for any homework submitted without this information. Please take the time to write clear and concise solutions; we will not grade messy or unreadable submissions. The lowest two homework scores will be dropped. No late homeworks will be accepted.

  1. Due: Tuesday, 4 September. Problems Solutions
  2. Due Tuesday, 11 September. Problems Solutions
  3. Due Tuesday, 18 September. Problems Solutions
  4. Due Tuesday, 25 September. Problems Solutions
  5. Due Tuesday, 2 October. Problems Solutions
  6. Due Monday, 8 October. Problems Solutions
  7. Due Tuesday, 23 October. Problems Solutions
  8. Due Tuesday, 30 October. Problems Solutions
  9. Due Tuesday, 6 November. Problems Solutions
  10. Due Monday, 12 November. Problems Solutions
  11. Due Tuesday, 27 November. Problems Solutions
  12. Due Tuesday, 4 December. Problems Solutions
  13. Due Tuesday, 11 December. Problems Solutions



There will be two midterms and one final. Dates and other details will be announced in due course.


There will be a short quiz at the beginning of the sections on randomly selected dates. The quiz will consist of a small number of very simple questions related to the material of the previous class. The two lowest quiz scores will be dropped. The motivation for the quizzes is twofold: (1) to encourage you to review the material of each class; (2) to encourage attendance at sections.


Your grade in the class will be determined as follows: Homeworks 25%; Midterms 20% each; Final 30%; Quizzes 5%.


Prerequisites: Formal prerequisites are CS61B and either CS70 or Math55. In particular, you should be comfortable with mathematical induction, big-O notation, basic data structures and binary heaps. If you need to refresh any of this background, you should refer to the relevant portions of the book. It is also assumed that you have experience with programming in a standard imperative language such as C, C++ or Java. Although most homeworks will be pencil-and-paper exercises, you may also be expected to do some small programming assignments.

Contact Information: The instructor and TAs will post announcements, clarifications, hints, etc. to this website and/or to the class newsgroup, ucb.class.cs170. Hence you must check this website and the newsgroup frequently throughout the semester. For information on how to access UCB newsgroups, go here (see also here for more).

If you have a question, your best option is to post a message to the newsgroup. The staff (instructor and TAs) will check the newsgroup regularly, and if you use the newsgroup, other students will be able to help you too. When using the newsgroup, please avoid off-topic discussions, and please do not post answers to homework questions before the homework is due.

If your question is personal or not of interest to other students, you may send email to cs170@cory.eecs. Email to this address is forwarded to the instructor and all TAs. We prefer that you use this address, rather than directly emailing the instructor and/or your TA. If you wish to talk with one of us individually, you are welcome to come to our office hours. If the office hours are not convenient, you may make an appointment with any of us by email. Please reserve email for the questions you can't get answered in office hours, in discussion sections, or through the newsgroup.

In a class this large, it can be challenging for the instructor to gauge how smoothly the class is going. We always welcome any feedback on what we could be doing better. If you would like to send anonymous comments or criticisms, please feel free to use an anonymous remailer like this one to avoid revealing your identity.

Collaboration: You are encouraged to work on homework problems in study groups of two to four people; however, you must write up the solutions on your own, and you must never read or copy the solutions of other students. Similarly, you may use books or online resources to help solve homework problems, but you must credit all such sources in your writeup and you must never copy material verbatim. Warning: Your attention is drawn to the Department's Policy on Academic Dishonesty. In particular, you should be aware that copying solutions, in whole or in part, from other students in the class or any other source without acknowledgment constitutes cheating. Any student found to be cheating risks automatically failing the class and being referred to the Office of Student Conduct.

Regrading Policies: Regrading of homeworks or exams will only be undertaken in cases where you believe there has been a genuine error or misunderstanding. Bear in mind that our primary aim in grading is consistency, so that all students are treated the same; for this reason, we will not adjust the score of one student on an issue of partial credit unless the score allocated clearly deviates from the grading policy we adopted for that problem. If you wish to request a regrading of a homework or exam, you must return it to your section TA with a written note on a separate piece of paper explaining the problem. The entire assignment may be regraded, so be sure to check the solutions to confirm that your overall score will go up after regrading. All such requests must be received within one week from the date on which the homework or exam was made available for return.


The following tips are offered based on our experience with Upper Division classes in CS Theory. If you follow these guidelines, you will make life much easier for yourself in this class.

1. Don't fall behind! In a conceptual class such as this, it is particularly important to maintain a steady effort throughout the semester, rather than hope to cram just before homework deadlines or exams. This is because it takes time and practice for the ideas to sink in. Make sure you allocate a sufficient number of hours every week to the class, including enough time for reading and understanding the material as well as for doing assignments. (As a rough guide, you should expect to do at least one hour of reading and two hours of problem solving for each hour of lecture.) Even though this class does not have any major projects, you should plan to spend as much time on it as on any of your other Upper Division technical classes.

2. Take the homeworks seriously! The homeworks are explicitly designed to help you to learn the material as you go along. Although the numerical weight of the homeworks is not huge, there is usually a strong correlation between homework scores and final grades in the class. Also, regardless of how well you did on the homework, read the sample solutions, even for the problems you got right. You may well learn a different way of looking at the problem, and you may also benefit from emulating the style of the solutions. (In science people learn a lot from emulating the approach of more experienced scientists.)

3. Make use of office hours! The instructor and TAs hold office hours expressly to help you. It is often surprising how many students do not take advantage of this service. You are free to attend as many office hours as you wish (you are not constrained just to use the office hours of your section TA). You will also likely get more out of an office hour if you have spent a little time in advance thinking about the questions you have, and formulating them precisely. (In fact, this process can often lead you to a solution yourself!)

4. Take part in discussion sections! Discussion sections are not auxiliary lectures. They are an opportunity for interactive learning, through guided group problem solving and other activities. The success of a discussion section depends largely on the willingness of students to participate actively in it. As with office hours, the better prepared you are for the discussion, the more you are likely to get out of it.

5. Form study groups! As stated above, you are encouraged to form small groups (two to four people) to work together on homeworks and on understanding the class material on a regular basis. In addition to being fun, this can save you a lot of time by generating ideas quickly and preventing you from getting hung up on some point or other. Of course, it is your responsibility to ensure that you contribute actively to the group; passive listening will likely not help you much. And recall the caveat above that you must write up your solutions on your own.