CS 332: Algorithms

Time: MWF 9-9:50 AM 
Place: OLS 011
Instructor: David Luebke
Office hours: Mondays & Thursdays 10-11 AM
Location: Olsson #219
Assistants: Pavel Sorokin, ps7k@cs.virginia.edu 
Office hours: Mondays 2-4 PM, Fridays 3-5 PM (+ 5-6 PM if necessary).
Location: CS Library, Olsson #236
Assignments: Homework 1: Due Monday, January 28
Homework 2: Due Wednesday, February 6
Homework 3: Due Wednesday, February 13
Homework 4: Due Friday, March 9 (Some sample code)
Homework 5: Due Friday, April 12
Homework 6: Due Monday, April 22
Homework 7: Due Thursday, May 2

Change in grading policy: I will drop the lowest homework grade

Grade Book: Check your grades on toolkit.
Feedback: Send us anonymous feedback on toolkit.
Format: Three lectures per week, with several homework assignments and two or three tests.
Prerequisites: Grades of C- or better in CS 216, CS 202.  CS 302 is recommended but not required.
Description: This course will provide a rigorous introduction to the design and analysis of algorithms. We will discuss classic problems (e.g., sorting, traveling salesman problem), classic algorithm design strategies (e.g., divide-and-conquer, greedy approaches), and classic algorithms and data structures (e.g., hash tables, Dijkstra's algorithm). We will also analyze algorithm complexity throughout, and touch on issues of tractibility such as "NP-Completeness".
Texts: Required: Introduction to Algorithms (Second Edition) by Cormen, Leiserson, Rivest, and Stein, McGraw-Hill (2001).

This book is similar to the first edition, so you could probably get by with only the first edition.  However, all homework problems assigned from the book will be referenced from the second edition; it is your responsibility to find a way to look them up.  I strongly recommend that you buy the text rather than borrow it; this is one of only two text books that I still use on a regular basis.  It is an indispensable reference.

Lectures: A tentative schedule of lecture topics is given below. The "CULTURE" topics represent interesting but non-essential material from fields such as computational geometry and computer graphics; they add some variety to the schedule but also give us some slack if we get behind schedule.  If we cover a "culture" topic in class, you will be tested on it.
Number Date Topic Source Text
1 1/16 Introduction, administration, time and space complexity


2 1/18 Basics: asymptotic notation PPT 3.1-3.2
3 1/21 Basics: recurrences (mergesort) PPT 4.1
4 1/23 Basics: recurrences continued, master theorem PPT 4.3, 6.1-6.2
5 1/25 Sorting: intro to heapsort PPT 6, 7.1-7.3
6 1/28 Sorting: heapsort, priority queues PPT 7.4
7 1/30 Sorting: quicksort PPT 5.1-5.3
8 2/1 Sorting: quicksort average case analysis PPT 5.4 last section
9 2/4 Sorting: linear time sorting algorithms PPT 8.1-8.2
10 2/6 Sorting: linear time algorithms continued;
Order statistics: selection in expected linear time
PPT 8.3-8.4
11 2/8 Order statistics: selection in worst-case linear time PPT 9.3
12 2/11 Review for exam PPT
EXAM 2/13 EXAM 1: Basics, Sorting, Order Statistics --
13 2/15 Structures: binary search trees PPT 12.1-12.3
14 2/18 Structures: red-black trees PPT 13.1-13.2
15 2/20 Structures: red-black trees (insertion) PPT 13.3-13.4
16 2/22 Structures: skip lists PPT --
17 2/25 Structures: skip lists, hash tables  PPT 11.1-11.2
18 2/27 Structures: hash tables (hash functions) PPT 11.3-11.4
19 3/1 Structures: hash tables (universal hashing) PPT 11.3-11.4
20 3/4 Augmenting structures: dynamic order statistics PPT 14.1-14.2
21 3/6 Augmenting structures: interval trees PPT 14.3
22 3/8 Graph algorithms: the basics PPT 22.1-22.3
23 3/18 Graph algorithms: BFS PPT 22.3
24 3/20 Graph algorithms: DFS PPT 23.1
EXAM 3/22 EXAM 2: Data structures --
-- 3/25 Go over exam --
25 3/27 Minimum spanning trees PPT 23.2
26 3/29 Shortest paths: Bellman-Ford PPT 24.1-24.3
27 4/1 Shortest paths: DAG, Dijkstra's algorithm PPT
28 4/3 Finish Dijkstra's.  Kruskals algorithm; disjoint sets PPT 21.1-21.3, 23.2
29 4/5 Disjoint sets; amortized analysis PPT 17.1-17.2
30 4/8 Amortized analysis continued PPT 17.3-17.4
31 4/10 Dynamic programming  PPT 15.1, 15.3
32 4/12 Dynamic programming (longest common subsequence) PPT 15.4
33 4/15 Dynamic programming (knapsack problem) PPT
34 4/17 Greedy algorithms  PPT 16.1-16.2
35 4/19 NP-Completeness PPT 34.1-34.2
36 4/22 NP-Completeness continued PPT 34.1-34.2
37 4/24 NP-Completeness: reductions PPT 34.3-4
38 4/26 NP-Completeness: reductions PPT 34.3-4
39 4/29 Review for final PPT --
Grading: The final grade will be calculated as a weighted average:
  • Assignments: 30%
  • Exam 1: 15%
  • Exam 2: 15%
  • Final: 35%
  • Participation: 5%
Assignments will be graded on a 100-point scale. Participation means coming to class, asking questions, taking part in discussions, not falling asleep, and so on.
Late Assignments: Assignments are always due at the beginning of class on the due date, or at 11:59 PM on the due date if there is no class that day. Assignments one day late subtract 10%; two days late loses 30%. After 2 days the assignment will be considered a zero.
Honor Code: The honor code applies to all work turned in for this course. 

Regarding homework: assignments are designed to facilitate your learning of the concepts; it is important that you understand the solutions to all problems, and the best way to gain an understanding is to work them out and write them up by yourself. However, there are occasions when outside help can be beneficial. Hence the policy: you are free to talk to others about problems at your discretion (though we strongly suggest you do this only when completely stuck), but you may not leave a meeting with any type of record of or notes pertaining to the discussion. (If you can recall the solution from memory, you probably understand it.) The actual write-up must be done entirely by yourself.