Efficient Algorithms and Intractable Problems

Spring 2010

Announcements People Sections Homeworks Exams Notes and Text Grades


  • (5/13) The final exam will be Friday, May 14, from 8-11am in Bechtel (Sibley) Auditorium.
  • (5/8) For the final, you are allowed to bring 2 double-sided sheets of notes, legible without a magnifying glass.
  • (5/7) See the discussion below under "Exams" about the make-up final.
  • (4/28) There will be a final review session on Friday May 7, during the regular lecture time, 9:30-11 in 306 Soda.
  • (4/27) Next semester, Fall 2010, CS194, Computational Biology, will be offered. CS170 is the prerequisite, so if you liked CS170, you might like Computational Biology.
  • (4/26) ROOM CHANGES: Starting April 26, Section 102 will move back to 85 Evans Hall, and Section 101 will move to 118 Barrows Hall.
  • (4/25) Meromit's office hours on Wednesday 4/28 are postponed to Friday 4/30 from 11am-1pm.
  • (4/6) Solutions to practice problems for Midterm 2 from Meromit's section on 4/5 are available here.
  • (4/5) A small correction to the solution of Homework 6 has been posted.
  • (4/5) SECTION ROOM CHANGE: From 4/5 until 4/25, section 102 will meet in Barrows 122 from 3-4pm
  • (4/5) A small correction to the solution of the first homework problem in Homework 7 has been posted.
  • (3/7) Starting March 10, Prof. Demmel's Wednesdsay office hours will be 1-2pm instead of 2-3pm.
  • (2/10) Prof. Demmel will not have regular office hours today (from 2-3). Stay tuned to this webpage for a rescheduled time.
  • (1/29) We have posted additional lecture notes on memory hierarchies and matrix multiplication for Lecture 4 (in pdf).
  • (1/27) To see a list of the 500 fastest computers in the world, and how parallel they are etc, see www.top500.org.
  • (1/27) We have posted additional lecture notes on parallelism for Lecture 3 (in pdf).
  • (1/26) Prof. Demmel needs to cancel his office hours on Thursday, Jan 28, 1:30-2:30pm
  • (1/21) Note the change in Prof. Demmel's office hours.
  • (1/20) Welcome to CS170!

  • People and contact information

    Lecturer: Professor James Demmel - email to demmel@cs

    Office: 564 Soda, 643-5386; also 831 Evans
    Lectures: WF 9:30-11:00 (306 Soda)
    Office hours: W 1-2 and Th 1:30-2:30 (note change) in 564 Soda, or by appointment


  • Daniel Preda, - email to dpreda@cs
    Office hours Th 3-4 in 711 Soda Hall (west alcove)
  • Meromit Singer, - email to meromit@cs
    Office hours W 11-12 and W 3-4, 611 Soda Hall (west alcove)
  • Please send questions about homework to all 3 instructors (professor and TAs) by using the newsgroup or by emailing cs170@inst.eecs.berkeley.edu; you are likely to get a faster answer that way. Instructions to access the newsgroup are available here.

    Discussion Sections

  • M 1-2, 87 Evans, (Daniel)
  • M 3-4, 85 Evans, (Meromit)
  • M 4-5, 2 Evans, (Meromit)
  • Enrollment: Please send all queries to Michael-David Sasson.


    Please send questions about homework to all instructors by using the newsgroup or by emailing cs170@inst.eecs.berkeley.edu; you are likely to get a faster answer that way. Instructions to access the newsgroup are available here.

    The (roughly weekly) homework sets (and solutions) will be posted here as the term progresses.

    In general, problem sets will be assigned on Wednesday and will be due Friday the following week at 4pm in the boxes in 283 Soda Hall. Make sure to put your name, SID, course name (CS170), homework number, TA's name, and section number on the first page, and staple all the pages together.

    For homework questions that involve designing and analyzing algorithms, we require a specific format for the answers (to both help you organize your thoughts and help the readers grade your answers), that you can find here.

    You are encouraged to work on homework problems in study groups of 2 to 4 people. But you must write up your own solutions, and not read or copy the solutions of other students. You may use books or on-line resources to help solve homework problems, but you must credit all such sources in your writeup and you must not copy material verbatim. See also the discussion of grading and academic honesty below. We believe that most students can distinguish between helping other students and cheating. Explaining the meaning of a question, discussing a way of approaching a solution, or collaboratively exploring how to solve a problem within your group is an interaction that we encourage. On the other hand, you should never read another student's solution or partial solution, nor have it in your possession, either electronically or on paper. You must never share your written solutions, or a partial solutions, with another student, even with the explicit understanding that it will not be copied. You should write your homework solution strictly by yourself. You must explicitly acknowledge everyone who you have worked with or who has given you any significant ideas about the homework. Not only is this good scholarly conduct, it also protects you from accusations of theft of your colleagues' ideas.

    Warning: Your attention is drawn to the Department's Policy on Academic Dishonesty. In particular, you should be aware that copying or sharing 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.

    No late homework will be accepted, since the answers will be posted on the web immediately afterwards. Instead, the lowest 3 homework scores will be dropped.

  • Homework 1 (in pdf), due Jan 29 (answers (in pdf))
  • Homework 2 (in pdf), due Feb 5 (answers (in pdf))
  • Homework 3 (in pdf), due Feb 12 (answers (in pdf))
  • Homework 4 (in pdf), due Feb 19 (answers (in pdf))
  • There is no homework assigned for Feb 26 (the date of the first midterm)
  • Homework 5 (in pdf), due Mar 5 (answers (in pdf))
  • Homework 6 (in pdf), due Mar 12 (answers (in pdf)) (small correction posted 4/5, 10:45am)
  • Homework 7 (in pdf), due Mar 19 (answers (in pdf)) (small correction in first homework solution posted 4/5, 5:20am)
  • Homework 8 (in pdf), due Apr 2 (answers (in pdf))
  • Homework 9 (in pdf), due Apr 16 (answers (in pdf))
  • Homework 10 (in pdf), due Apr 23 (answers (in pdf))
  • Homework 11 (the last!) (in pdf), due Apr 30 (answers (in pdf))

  • Exams and Quizzes

  • There will be a short, closed-book quiz at the beginning of each discussion section.
  • The rules for the exams are as follows: Closed book, closed calculator, closed computer, closed network, and open brain. You are permitted a 1 page, double-sided set of notes, large enough to read without a magnifying glass.
  • The final is Friday, May 14, 8-11am, in Bechtel (Sibley) Auditorium.
  • Midterm 1 will be in class on Friday, Feb 26. It will cover material through the end of Chap 3. For old midterms (which may cover slightly different material) see the examples below:
  • Midterm 2, with answers, from this semester (in pdf)
  • Midterm 2 grade histogram , from this semester (in pdf), Midterm 2 average score = 40 out of 60
  • Midterm 1, with answers, from this semester (in pdf)
  • Midterm 1 grade histogram , from this semester (in pdf)
  • Midterm 1, with answers, from 2007, (in pdf)
  • Midterm 1, with answers, from 1999, (in pdf)
  • Midterm 1, with answers, from 1998, (in pdf)
  • Midterm 2, with answers, from 2007, (in pdf)
  • Midterm 2, with answers, from 1999, (in pdf)
  • Midterm 2, with answers, from 1998, (in pdf)
  • Final from 1998, in pdf
  • Final from 1999, in pdf
  • Final from 2001, in pdf
  • Final from 2007, in pdf
  • Midterm 2 will be in class on Wednesday, Apr 7
  • Sample midterms and finals from earlier semesters will be posted here, along with results from this semester.
  • For the final, you are allowed to bring 2 double-sided sheets of notes, legible without a magnifying glass.
  • There will be make-up finals on Friday, May 14, 12:30 - 3:30 in 310 Soda, and on Monday, May 17, 9-12, also in 310 Soda. If you need to take the make-up final, you have to take the one at the earliest time you are available. Students will receive individual email telling them which one to take.

  • Notes and Text

    The required textbook for the course is Algorithms, by Dasgupta, Papadimitriou and Vazirani.

    It was developed from a set of notes especially for this course, and we will follow it fairly closely. The previous text book was Introduction to Algorithms by Cormen, Leiserson and Rivest, which is still a good reference.

    Prerequisites: The prerequisites for this course are CS 61B, and either CS 70 or Math 55. In particular you should be comfortable with mathematical induction, big-O notation, and basic data structures. If you need to refresh any of this material, refer to the relevant sections of the textbook. We assume that you are familiar with a standard imperative programming language like C, C++ or Java, so that you can read and write the algorithms presented in the course.

    Before this textbook became available, I posted very detailed lecture notes for each lecture on this web page. The availability of this textbook means the notes will mostly point to the sections of the book covered, but I will continue to post more detailed notes of material not in the book.

    Tentative schedule and Lecture Notes


    Grades will be based on homework, quizzes, 2 midterms and a final:

    The final exam is scheduled for May 14, 8-11am. A makeup final will only be given for

    1. unexpected circumstances beyond your control, documented by a signed note from a physician or equivalent,
    2. a religious holiday, or
    3. conflict with another scheduled exam (ask the other professor first, and try to avoid this!!).
    There will be no makeup midterms. Instead, each midterm score will be replaced by the maximum of your midterm score and your score on the final (whether you take the midterm or not).

    You are required to a bring a student photo ID and blue-covered exam book to the exams.

    There will be a short quiz at the beginning of (most) sections. The quiz will consist of a few simple questions related to the material from the previous class. There will be no make-up quizzes but the two lowest quiz scores will be dropped. The motivation is to encourage you to keep up with lectures.

    Regrading of homework, quizzes or exams will be done when there has been a mistake, in order to make sure all students are graded consistently. To ask for a regrade, you must return the work to your TA within one week of getting it back, along with a written note (on another piece of paper) explaining the problem. The entire assignment may be regraded in this case.