CLR refers to Cormen, Leiserson, Rivest and Stein: "Introduction to Algorithms (Third Edition)". |
Lecture 1 (Jan 7) |
General introduction. Definition of an algorithm. Examples of simple computer models: Turing model, RAM model, pointer based machines, comparison model. RAM model (or uniform cost model), bit model (or: logarithmic cost model). Definition and examples of oracles (not done explicitly),. The Fibonacci example: introduce recursion, iteration (the array method), and fast exponentiation. Worst-case time complexity. Landau symbols: O, Omega, Theta, small o, small omega. Examples of many complexity classes (linear, quadratic, polynomial, exponential). Resources:
Exercise mentioned during the lecture:
Exercise to chew on, but not mentioned in class:
|
Lecture 2 (Jan 9) |
Introduction to the divide-and-conquer principle. Fast exponentiation revisited. Introduction to recurrences. The divide-and-conquer solution to the chip testing problem in CLR. Divide-and-conquer (Karatsuba) multiplication. Mergesort, convex hulls in the plane. We covered all of chapter 2 and part of chapter 3 of CLR. Resources:
Exercises mentioned during the lecture:
|
Lecture 3 (Jan 14) |
Binary search using a ternary oracle (with analysis by the substitution method). Strassen matrix multiplication. The master theorem (statement only). Recursion tree to explain the master theorem. Ham-sandwich and pancake theorems and halfspace counting. Resources:
|
Lecture 4 (Jan 16) |
Linear time selection: finding the k-th smallest by the algorithm of Blum, Floyd, Pratt, Rivest and Tarjan. O(n) complexity proof based on induction. Linear expected time selection by Hoare's algorithm "FIND". The induction method illustrated on mergesort. Euclid's algorithm for the greatest common divisor. Resources:
Exercises mentioned during the lecture:
|
Lecture 5 (Jan 21) |
Assignment 1 due at 4 pm on myCourses. Assignment 2 handed out (on myCourses). Due January 30, 2025, 4 pm. The Fast Fourier Transform. Multiplying polynomials in time O(n log n). Resources:
|
Lecture 6 (Jan 23) |
Dynamic programming. Computing binomial coefficients and partition numbers. The traveling salesman problem. The knapsack problem. The longest common subsequence problem. Resources:
Exercises mentioned in class:
|
Lecture 7 (Jan 28) |
Lower bounds. Oracles. Viewing algorithms as decision trees. Proof of lower bound for worst-case complexity based on decision trees. Examples include sorting and searching. Lower bounds for board games. Finding the median of 5 with 6 comparisons. Merging two sorted arrays using finger lists. Lower bounds via witnesses: finding the maximum. Resources:
Practice: What is meant by the statement that for an algorithm A, the worst-case time T_n (A) is Ω(n^2)? And what is meant when we say that for a given problem, the lower bound is Ω(n^7)? |
Lecture 8 (Jan 30) |
Assignment 2 due at 4 pm. Assignment 3 handed out. It is due on February 9 at 10 pm. Lower bounds via adversaries. Guessing a password. The decision tree method as a special case of the method of adversaries. Finding the maximum and the minimum. Finding the median. Finding the two largest elements. Resources:
An exercise and a question asked in class:
|
Lecture 9 (Feb 4) |
Introductory remarks about ADTs (abstract data types). Lists. Primitive ADTs such as stacks, queues, deques, and lists. Classification and use of linked lists, including representations of large integers and polynomials, window managers, and available space lists. Uses of stacks and queues in recursions and as scratchpads for organizing future work. Introduction to trees: free trees, ordered trees, position trees, binary trees. Bijection between ordered trees (forests) and binary trees via oldest child and next sibling pointers. Relationship between number of leaves and number of internal nodes with two children in a binary tree. Complete binary trees: implicit storage, height. Resources:
Exercises mentioned in class:
|
Lecture 10 (Feb 6) |
Assignment 3 due on February 9 at 10 pm. Continuing with trees. Depth, height, external nodes, leaves, preorder numbers, postorder numbers. Preorder, postorder, inorder and level order listings and traversals. Recursive and nonrecursive traversals. Stackless traversal if parent pointers are available. Representing and storing trees: binary trees require about 2n bits. Counting binary trees (Catalan's formula) via counting Dyck paths. Expression trees, infix, postfix (reverse Polish), and prefix (Polish) notation. Resources:
Exercises mentioned in class:
|
Lecture 11 (Feb 11) |
Introduction to the ADT Dictionary. Definition of a binary search tree. Standard operations on binary search trees, all taking time O(h), where h is the height. Generic tree sort. The browsing operations. Definition of red-black trees. Red-black trees viewed as 2-3-4 trees. Resources:
Exercises mentioned in class:
Exercise not mentioned in class:
|
Lecture 12 (Feb 13) |
Relationships between rank, height and number of nodes. Insert operation on red-black trees. Standard deletion is not covered in class. Lazy delete. Split and join in red-black trees. Application to list implementations (concatenate and sublist in O(log n) time). Definition of HB-k, AVL and 2-3 trees. Resources:
Exercises mentioned in class:
|
Lecture 13 (Feb 14) |
Assignment 4 handed out, due February 27, 9 pm. Augmented data structures. Examples:
Resources:
|
Lecture 14 (Feb 18) |
Midterm examination, McMed 504: 4:30-6 pm. |
Lecture 15 (Feb 20) |
Cartesian trees. Random binary search trees. Treaps. Analysis of the expected time of the main operations. Quicksort revisited. Resources:
|
Lecture 16 (Feb 25) |
Hashing. Direct addressing. Hashing with chaining. Open addressing. Bloom filters. Resources:
|
Lecture 17 (Feb 27) |
Assignment 4 due at 2:37 am on March 1, 2025. Priority queues (as abstract data types). Uses, such as in discrete event simulation and operating systems. Binary heaps. Heapsort. Pointer-based implementation of binary heaps. Tournament trees. k-ary heaps. Resources:
Suggested exercise: in class, we implemented a lazy deletemin in a tournament tree. How would you implement a true deletemin? |
Lecture 18 (Mar 11) |
Assignment 5 posted on myCourses on March 2, 2025. It is due on March 15, at 1:11 am. Amortization. Potential functions. Examples:
Resources:
Exercise suggested in class: if one wants to keep the load factor in a hash table with chaining between 1/2 and 2, one may occasionally rehash, with the load factor exactly one (after rehashing). Show that the expected amortized complexity of insert, delete, search, and rehashing is O(1). The key is to invent an appropriate potential. |
Lecture 19 (Mar 13) |
Stringology. Data structures for strings and compression. Tries, PATRICIA trees, digital search trees. Suffix tries, suffix trees, suffix arrays. String searching in a large file via the Knuth-Morris-Pratt algorithm. Resources:
Exercises:
|
Lecture 20 (Mar 18) |
Assignment 6 handed out. It is due on March 28 at 11:59pm. Introduction to compression and coding. Fixed and variable width codes. Prefix codes. Huffman trees. Huffman code. An O(n log n) algorithm for finding the Huffman tree. Definition of a greedy algorithm. Data structures for Huffman coding. Merging sorted lists by the greedy method. Resources:
Exercises:
|
Lecture 21 (Mar 20) |
Definition of entropy and Shannon's result on best possible compression ratios. Entropy of an input source. Kraft's inequality. Proof of Shannon's theorem. The Shannon-Fano code. Lempel-Ziv compression. Data structures for Lempel-Ziv compression. Digital search tree. Resources:
Exercises:
|
Lecture 22 (Mar 21) |
Introduction to graphs: notation, definitions, adjacency matrix, adjacency lists. Graph traversals as the fundamental procedures for most graph algorithms: depth first search. DFS forest and DFS properties. Classification of edges. Detecting cycles. Resources:
Exercises:
|
Lecture 23 (Mar 25) |
Euler tour. Breadth first search. BFS tree. Shortest path problem. Shortest path properties. Dijkstra's greedy algorithm for shortest paths. Resources:
Exercises:
|
Lecture 24 (Mar 27) |
Minimal spanning tree. Main properties. Greedy approach for the MST: the Prim-Dijkstra algorithm. Application in hierarchical clustering. Kruskal's algorithm. A two-approximation for the traveling salesman problem. The all-pairs shortest path algorithm of Floyd and Warshall. Transitive closure of a graph and matrix multiplication. Resources:
Exercises:
|
Lecture 25 (Apr 8) |
Directed acyclic graphs (or: dags). Topological sorting. Activity (PERT) networks. NIM games. Strongly connected components in directed graphs. Resources:
Exercises:
|
Lecture 27 (Apr 10) |
Network flows. The Ford-Fulkerson method. The Edmonds-Karp algorithm. Resources:
|