Efficient Algorithms and Intractable Problems

Spring 2007

Announcements People Sections Homeworks Exams Notes and Text Grades


Announcements will be made here and on the CS170 newsgroup.

  • (5/10) Final Review sessions and other information about the final are posted below.
  • (5/8) Old final exams posted below.
  • (4/25) HKN Class Surveys will be Tuesday, May 1. Please attend!
  • (4/25) Histogram of scores from Midterm 2 are now posted.
  • (4/3) Review session for second midterm is posted below. We will use the same rules about bringing notes as for the first midterm.
  • (3/20) Last 3 questions of Homework 9 are deferred until Mar 25 at 4pm (email submission ok). See below for details.
  • (3/3) New Corrections to answers to Homework 4 have been posted (sorry about that).
  • (3/2) Histogram of scores from Midterm 1 are now posted.
  • (3/2) Answers to Homeworks 5 and 6 have been posted. Corrections to answers to Homework 4 have been posted.
  • (2/22) All of Homework #5 deferred until Monday, 2/26 at 4pm. This supersedes the following announcement from 2/21.
  • (2/21) Homework question 3.4 is deferred until next week (see below).
  • (2/15) Review session for first midterm is posted. You are allowed to bring one page of notes to the exam (see below).
  • (2/6) Midterm dates are posted.
  • (2/6) Lecture notes for material on matrix multiplication from Lecture 7 have been posted.
  • (2/5) Lecture notes for material on parallelism from Lecture 6 have been posted.
  • (1/26) CS 170 student Tom Miller (wheeleze@yahoo.com) is looking to hire a note taker for lecture and discussion, who will be paid by the campus. Interested parties should contact him or 260 Cesar Chavez Student Center.
  • (1/26) Please remember to bring a small photo of yourself to section, as requested on Homework 1.
  • (1/23) Romain Thibaux's office hours have moved.
  • (1/22) A few more comments on the level of proof for HW 1 have been added below.
  • (1/22) Note change of office hours for Steve Houston
  • (1/19) See below for discussion of the level of proof desired for Homework 1.
  • (1/17) section 101, F 9-10am, has been cancelled because of low enrollment. The students who had been registered in this section should please enroll in one of the remaining 4 sections.
  • (1/16) Welcome to CS170!

  • People

    Lecturer: Professor James Demmel - demmel@cs

    Office: 737 Soda, 643-5386
    Lectures: TuTh 12:30-2:00 (50 Birge)
    Office hours: W 10:00 - 11:00, Th 2:15 - 3:15, or by appointment


  • Romain Thibaux,
    Office hours T 11:15-12:15, W 12:30-1:30, Soda 751 (alcove)
  • Steve Houston
    Office hours M W 4-5pm, 711 Soda (alcove) Email: shouston at eecs

  • Discussion Sections

  • F 9-10, 71 Evans, (CANCELLED)
  • F 10-11, 70 Evans, limit 30 (Steve)
  • F 11-12, 75 Evans, limit 30 (Steve)
  • F 12-1, 71 Evans, limit 30 (Romain)
  • F 1-2, 310 Hearst Mining, limit 30 (Romain)
  • Enrollment: There should be no limit on enrollment, as long as you try to enroll in a section that is not full (and have fulfilled the prerequisites, see below).


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

    In general, problem sets will be assigned on Tuesday and will be due Thursday the following week at 4pm in the boxes in 283 Soda Hall. Make sure to put your name, SID, course name (CS170) and section number on each page.

    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.

    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, out Jan 16, due Jan 25. pdf
    Exercise 0.1 gives you pairs of function f(n) and g(n), and asks you to decide if f = O(g), among other things. Here is the level of justification we expect. You should use rules that you should have learned in Ma55 or CS70, namely
  • f1 = O(g1) and f2 = O(g2) implies f1+f2 = O(|g1| + |g2|)
  • f1 = O(g1) and f2 = O(g2) implies f1*f2 = O(g1 * g2)
  • n^a = O(n^b) if a < b
  • a^n = O(b^n) if a < b
  • log n = O(n)
  • n = O(b^n) for any b>1
  • if |f(n)/g(n)| approaches a finite nonzero constant as n -> infinity, then f = Theta(g)
  • if |f(n)/g(n)| approaches 0 as n -> infinity, then f = O(g) but not Omega(g)
  • If you can't apply any of these, you may go back to the definition of O(), but we prefer short answers based on these rules. For example, it is enough to write "10 + n + n^2 = O(n^2)" without further explanation.
    Answers to Homework 1, in pdf
  • Homework 2, out Jan 23, due Feb 1. pdf
    Answers to Homework 2, in pdf
  • Homework 3, out Feb 1, due Feb 8.
    DPV: 2.5, 2.11, 2.15, 2.18, 2.24, 2.26, 2.32
    Answers to Homework 3, in pdf
  • Homework 4, out Feb 6, due Feb 15. pdf
    Answers to Homework 4, in pdf (Corrected 3/3)
  • The due date for this entire homework is postponed until Monday 2/26 at 4pm. Question 3.4 is due at the same time.
    Homework 5, out Feb 14, due Feb 22.
  • 3.2, 3.3,
  • 3.4 (just draw the graphs labelled with the requested information)
  • 3.8, 3.12, 3.26, 3.31
  • Answers to Homework 5, in pdf
  • Homework 6, out Feb 26, due Mar 1. pdf
    Answers to Homework 6, in pdf
  • Homework 7, out Mar 2, due Mar 8
    DPV: 4.1, 4.2, 4.4, 4.5, 4.13, 4.19, 4.21,
    Answers to Homework 7, in pdf
  • Homework 8, out Mar 10, due Mar 15
    DPV: 5.2, 5.7, 5.9a-e, 5.14, 5.16, 5.19, 5.22
    Answers to Homework 8, in pdf
  • Homework 9, out Mar 18, due Mar 22
    DPV: 6.2, 6.6, 6.8, 6.14
  • Homework 9+, out Mar 18, due Mar 25, 4pm (email submission ok) 6.20, 6.25, 6.26
    Answers to Homework 9, in pdf
  • Homework 10, out Apr 5, due Apr 12
    DPV: 7.4, 7.7, 7.8, 7.10, 7.11, 7.18, 7.30
    Answers to Homework 10, in pdf
  • Homework 11, out Apr 13, due Apr 19
    DPV: 7.15, 7.21, 7.24
    DPV: 8.1, 8.2, 8.21
    Answers to Homework 11, in pdf
  • Homework 12, out Apr 20, due Apr 26
    DPV: 8.6, 8.9, 8.10, 8.12, 8.18
    Answers to Homework 12, in pdf
  • Homework 13 (the last!), out Apr 26, due May 3
    DPV: 9.2, 9.4, 9.6, 9.8
    Answers to Homework 13, in pdf

  • Exams

  • You are permitted 2 sheets of double-sided notes (i.e. 4 pages in all) for the final, large enough to read without a magnifying glass. This is a change to the earlier rules that allowed 1 double-sided sheet.
  • There will be two review sessions for the final exam, both in 306 Soda: Friday, May 11, from 12-2pm, and Tuesday, May 15, from 6-8pm.
  • The rules for the final exam are identical to the midterms: 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. (SEE CHANGE ABOVE)
  • A review session for Midterm 2 will be held in 159 Mulford from 6:30-8:30pm on Tuesday April 3.
  • The midterm will be 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.
  • A review session for Midterm 1 will be held in 141 McCone on Friday Feb 16 from 4-5pm, or later if there are questions. Note: we had originally planned to post midterms from earlier semesters, but have decided not to since we are presenting material in a different order so the earlier midterms cover different subsets of the material. The best way to study is to look at other homework questions in Chapters 0, 1 and 2, and go to the review session.
  • Midterm 1 will be in class on Feb 20.
  • Midterm 2 will be in class on Apr 5.
  • Sample midterms and finals from earlier semesters will be posted here, along with results from this semester.
  • Midterm 1, with answers, in pdf
  • Histogram of scores from Midterm 1
  • Midterm 1 (with answers) from 1998, in pdf
  • Midterm 1 (with answers) from 1999, in pdf
  • Midterm 2 (with answers) from 1998, in pdf
  • Midterm 2 (with answers) from 1999, in pdf
  • Midterm 2, with answers, in pdf
  • Histogram of scores from Midterm 2
  • Final from 1998, in pdf
  • Final from 1999, in pdf
  • Final from 2001, in pdf

  • 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.

    Syllabus and Lecture Notes



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

    The final exam is schedule for May 16, 5-8pm. 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.