[ news | information | lectures | problem sets | links ]

CS140 - Fall 2009
MW 1:15-2:30 in Edmunds 101
Prof. Chen

7/6/2010: I've archived all of the notes and problem sets (ie, most of the links below don't work) and am only leaving up the syllabus for reference. If you're looking for the material, you may be able to find a link to a more recent offering of the class here or here.


Please check here regularly for assorted announcements. You are responsible for being aware of any information posted here.
  • 12/14/2009: The cover page of the cs140 final is available here.
  • 12/10/2009: No TA hours on Sunday. I will have office hours next week from 3-4PM on Monday, Tuesday, and Thursday.
  • 11/10/2009: TA hours for this week only: Sunday hours on 11/15 have all been cancelled. There will be office hours at HMC in B-105 from 11:30-12:30 on Friday 11/13, 1-2PM on Saturday 11/14, and 6-7PM on Saturday 11/14. There will be office hours at Pomona on Saturday 11/14 from 3-4PM.
  • 10/6/2009: TA hours for this week only: Sunday hours on 10/11 have all been cancelled. Yaniv and possibly one other TA will be available in B-105 from 11:30-12:30 on Friday 10/9 and 5-6PM on Saturday 10/10. Lucy will have office hours at Pomona on Saturday 10/10 from 3-4PM.
  • 10/5/2009: in problem 1 on problem set 6a, "heapDelete" is the "delete(H,x)" operation discussed in class.
  • 9/15/2009: HMC tutoring hours have moved to B-105.
  • 9/9/2009: Typo on ps2b: it's due at 1:15PM and not 2:45PM.
  • 9/7/2009: updates to TA hours:
  • 9/3/2009: I just email to the class with a clarification on problem 6c on problem set 1: assume that the elements in the tree are distinct (ie, no duplicate elements). [If you didn't get this email it means I didn't get a survey from you in class on Wednesday. Send me email.]
  • 8/22/2009: I was checking on textbooks in Huntley and found out that the order for cs140 wasn't processed, and that a third edition of the textbook is expected in September. Huntley is rushing in 12 used copies of the 2nd edition. I haven't seen the 3rd edition yet but, assuming they didn't remove any of the core material, if you're the kind of person who keeps textbooks forever as reference books, you may want to see if you can borrow someone else's 2nd edition and wait to buy the 3rd edition.
  • Information

    CS140 is an introduction to algorithm design and analysis techniques. The course covers basic techniques used to analyze algorithms, basic techniques used in designing algorithms, and important classical algorithms. The goal is to learn how to apply all of the above to designing solutions for real-world problems (a skill that you will practice throughout the semester). Grades will be based primarily on problem sets and exams, but participation will also be factored in.

    The prerequisites for the class are cs55/math55 and cs62/cs70. Exceptions will be made for students who have taken an advanced proof-based math course and cs52/cs60, but not cs62/cs70. Come talk to me if you have questions about these requirements.

    The lectures are on Mondays and Wednesdays from 1:15-2:30 in Edmunds 101.

    The textbook is Introduction to Algorithms, 2nd Edition by Cormen, Leiserson, Rivest, and Stein. A few used copies will be available at Huntley bookstore. Note that you will not need the CD that comes packaged with some versions of this book.

  • Administrivia <pdf>
  • Lectures

    Any topic/readings/assignments that are listed for a date in the future should be taken as tentative. Readings/assignments will be updated by the preceding class; lecture topics will be updated by the following class.

    Week Date In class Reading Assignment due
    1 (Wed) 9/2 introduction, administrivia
    2 (Mon) 9/7 loop invariants
    (Wed) 9/9 divide & conquer technique
    solving recurrences
    2.3, 4.1-2 ps2a
    3 (Mon) 9/14 more on solving recurrences
    bounding problems
    matrix multiplication
    4.3-4, 7.1-4 ps2b
    (Wed) 9/16 bounding problems
    linear time sorting
    8, 9, 28.2 ps3a
    4 (Mon) 9/21 data structures
    heaps and heapsort
    10, 6 ps3b
    (Wed) 9/23 amortized analysis 17 ps4a
    5 (Mon) 9/28 binary search trees
    balanced binary search trees
    red-black trees
    12, 13 ps4b
    (Wed) 9/30 disjoint sets using: linked lists, forests,
    union-by-rank, path compression
    21 ps5a
    6 (Mon) 10/5 mergeable heaps using: linked lists,
    heaps, binomial heaps
    19 ps5b
    (Wed) 10/7 review ps6a
    7 (Mon) 10/12 greedy algorithms 16 midterm
    (Wed) 10/14 dynamic programming 15 ps7a
    8 (Mon) 10/19
    *** no class: Fall Recess ***
    (Wed) 10/21 dynamic programming 15 ps7b
    9 (Mon) 10/26 bfs, dfs, topological sort,
    strongly connected components
    22 ps8
    (Wed) 10/28 minimum spanning trees 23 ps9a
    10 (Mon) 11/2 single source shortest paths:
    Bellman-Ford, Dijkstra's
    24 ps9b
    (Wed) 11/4 all pairs shortest paths:
    Floyd-Warshall, Johnson's
    25 ps10a
    11 (Mon) 11/9 topological sort
    network flow
    26 ps10b
    (Wed) 11/11 review ps11a
    12 (Mon) 11/16 network flow, Ford-Fulkerson 26 midterm
    (Wed) 11/18 Edmunds-Karp, max flow min cut 26 ps12a
    13 (Mon) 11/23 linear programming, integer linear programming 29 ps12b
    (Wed) 11/25
    *** class cancelled ***
    14 (Mon) 11/30 intro. computational complexity
    P, NP, NPC
    polynomial time reductions
    34.1-4 ps13
    (Wed) 12/2 NPC reductions 34.5 ps14a
    15 (Mon) 12/7 NPC reductions 34.5 ps14b
    (Wed) 12/9 approximation algorithms 35.1-2 ps15a

    The take-home final must be turned in by 5PM on Thursday 12/17.

    Problem Sets

  • ps1 <.tex> <.pdf>, LaTeX sample files: sample.tex, sample.pdf
  • ps2a <.tex> <.pdf>
  • ps2b <.tex> <.pdf>
  • ps3a <.tex> <.pdf>
  • ps3b <.tex> <.pdf>, sample files for problem 1: stock10.in, stock10.out
  • ps4a <.tex> <.pdf>
  • ps4b <.tex> <.pdf>, figure for problem 1: .pdf
  • ps5a <.tex> <.pdf>
  • ps5b <.tex> <.pdf>
  • ps6a <.tex> <.pdf>
  • ps7a <.tex> <.pdf>
  • ps7b <.tex> <.pdf>
  • ps8 <.tex> <.pdf>, figure for part 1: .pdf, sample files for part 2: blocks10.in, blocks10.out
  • ps9a <.tex> <.pdf>
  • ps9b <.tex> <.pdf>
  • ps10a <.tex> <.pdf>
  • ps10b <.tex> <.pdf>
  • ps11a <.tex> <.pdf>
  • ps12a <.tex> <.pdf>, figure for problem 1: .pdf
  • ps12b <.tex> <.pdf>
  • ps13 <.tex> <.pdf>
  • ps14a <.tex> <.pdf>
  • ps14b <.tex> <.pdf>
  • ps15a: problem 34-2 in CLRS (Bonnie and Clyde)
  • Links

  • web site for the textbook. Note the list of errata.
  • complexity:
  • complexity zoo
  • NP compendium
  • some pages discussing LaTeX, which is the best way to format anything containing mathematical equations.
  • A simple latex document sample.tex that creates the file <sample.pdf> (by running "pdflatex sample.tex")
  • A gentle introduction to TeX by Laura Tallman and Michael Kozdron.
  • The Not So Short Introduction to LaTeX2e, also known as LaTeX2e in 139 minutes by Oetiker, Partl, Hyna, and Schlegl. (This is an evolving document, at the moment they're on version 4.20, dated May 2006.)
  • Information specific to running TeX on the DCI systems is here, and information on TeX distributions can be found here.

  • "Computers do not solve problems, they execute solutions"
    --Laurent Gasser