CS2800 Design and Analysis of Algorithms

Jan - May 2023

Coordinates

  • Where: CS15
  • When: B slot - Mon (9 am), Tue (8 am), Wed (1 pm), Fri (11 am)

Instructor

TAs

Abhijit, Ankit, Anmol, Barenya, Bibhuti, Keshav, Ravi, Sampriti, Souradipta, Susmit

About this course

This course is an introductory course on the design and analysis of algorithms. It serves as a recommended, and sometimes necessary, prerequisite for almost all courses in the area of theoretical computer science offered in the CSE department. The emphasis is on understanding some basic design principles that can be applied in a variety of algorithmic questions. That said, these principles are neither exhaustive nor applicable in all situations. The hope is that the student gets sufficient background to think in a principled manner when confronted with a new computational question.

Prerequisites: The course on programming and data structures (CS2700/CS2705) is a necessary prerequisite for the course. In particular, I will assume that you know the following (which are typically covered in CS2700/CS2705): - The concept of an abstract data type and the difference between ADTs and data structures. - Basic ADTs like stacks, queues, priority queues. Basic data structures like arrays, linked lists, heaps, simple BSTs and operations on them. - The concept of pseudocode, and the difference between pseudocode and a computer program. - Algorithms for sorting, searching, and basic algorithms on graphs. - The concept of asymptotic analysis, and the definitions of \(O(\cdot), \Omega(\cdot)\), and \(\Theta(\cdot)\) as well as \(o(\cdot)\) and \(\omega(\cdot)\).

The course will require you to design algorithms, and then mathematically prove their correctness. There will not be any programming component for this course, though you may be required to implement a few of the algorithms if you take the lab course Object-Oriented Analysis, Implementation and Algorithms (OOAIA, CS2810).


Course contents

The course will look at some basic algorithm design techniques using examples. The contents of the course include the following topics:

  • Recursion and divide-and-conquer algorithms
  • Dynamic programming
  • Greedy algorithms
  • Graph algorithms like shortest path, minimum spanning trees
  • Brief introduction to intractability
  • Advanced topics (based on time): Randomization in algorithms, network flows, linear programming

The topics included above will be covered at different depths, and the order in which they are covered will also vary.


Course resources

There are many textbooks and resources (both offline and online) that cover most of the material presented in the list above. We will not be following one textbook. Our main sources of reference will be the following textbooks.

  1. Algorithms by Jeff Erickson - This book is freely available online and contains a large number of exercises with varying degrees of difficulty. This is a fairly recent book.
  2. Algorithm Design by Jon Klienberg and Eva Tardos - A slightly older textbook than the one by Erickson, this contains most of the material given in the course contents. It also contains chapters on topics that one might see in a slightly more advanced course. Copies are available in the library and the Indian edition is not too pricey (in case you are planning to buy).
  3. Introduction to Algorithms by Cormen ,Leiserson, Rivest and Stein (referred to as CLRS) - An old textbook, currently in its 4th edition. Copies are available in the library, and Indian editions (for the 2nd and 3rd editions) are not pricey.
  4. Algorithms by Dasgupta, Papadimitriou and Vazirani - Another nice book on algorithm design. Contains some topics that are not dealt properly in the three earlier books. Copies of the book are available in the library, but I am unable to find a cheap Indian edition of this book.

Apart from this, there are a lot of resources available online. We may refer to them occasionally. All these books contain a number of exercise problems for practice.

Weekly schedule
  • Lectures: Mon (9 am), Tue (8 am), Wed (1 pm)
  • Tutorials: Fri (11 am)

The Friday slot will be used for tutorials. This includes both ungraded practice tutorials, as well as mini-quizzes. Please see the details below to know the dates for the mini-quizzes and ungraded tutorials. We will stick to this schedule unless there is some unforeseen change in the academic calendar.


Grading policy (tentative)

The course will be evaluated through a series of quizzes and finally the end-sem. I will be releasing problem sets on a weekly basis, and we will have tutorial sessions to discuss the these problems and possible approaches to solving them. The tentative grading scheme is as follows.

Grading pattern
  • Mini-quizzes: 20% (best 2/4)
  • Quiz 1 & 2: 2 * 20 = 40%
  • End-sem: 40%

Important dates (tentative)

Please note the following dates for the ungraded tutorials and mini-quizzes. The dates for Quiz 1,2 and end-semester examination will be as per the institute calendar.

Dates
Practice tutorials Jan 20, Jan 27, Feb 10, Feb 17, Feb 24, Mar 3, Mar 17, Mar 24, Mar 31
Mini quizzes Feb 3, Mar 10, Apr 21, Apr 26
Quiz 1 Feb 21
Quiz 2 Mar 21
End-sem May 3
Contact

Please sign up on the course discussion forum here. This will be the first point of contact for any issues related to the course. Please do not email me or the TAs unless the issue is specific to you (like missing lectures, correction in grading). Even for such issues, we highly recommend you to message privately using the discussion forum.

For general questions related to the course (any comments/doubts), please create a topic in the correct stream and add you question/comment there. You are also welcome to reply and clear the doubts of your friends.

Date Lecture
Lecture #1
Mon 16/01
Introduction to the course; administrative details; algorithms for integer multiplication - what constitutes a good algorithm?
[slides]
References
  • Section 0.2 - Erickson
PS0 released
Lecture #2
Tue 17/01
Stable marriage problem; Gale-Shapley algorithm and examples
[slides]
References
  • Section 1.1 - [KT]
Lecture #3
Wed 18/01
Gale-Shapley algorithm - proof of correctness; properties of the solution and proof of optimality
[slides]
References
  • Section 1.1 - [KT]
Tutorial #1
Fri 20/01
Based on Problem set 0
Lecture #4
Mon 23/01
Recall of asymptotic analysis; Divide-and-conquer - Karatsuba's algorithm, recurrence relations, recurrence trees, master theorem
[slides]
References
  • Section 1.9 - Erickson
  • Section 2.1, 2.2 - [DPV]
  • Chapter 3 - [CLRS] (asymptotic notation)
  • Section 4.6 - [CLRS] (for a proof of the master theorem)
PS1 released
Lecture #5
Tue 24/01
Order statistics - finding the \(k^{th}\) smallest element; median-of-medians - recursive solution, analyzing the recurrence using recursion trees
[slides]
References
  • Section 1.8 - Erickson
Lecture #6
Wed 25/01
Convolution of vectors; equivalence with polynomial multiplication; evaluating polynomials on mulitple points; FFT algorithm
[slides]
References
  • Section 2.6 - [DPV]
Lecture #7
Mon 30/01
FFT algorithm (contd.); Closest pair of points in 2D
[slides]
References
  • Section 2.6 - [DPV]
  • Section 5.4 - [KT]
PS2 released
Lecture #8
Tue 31/01
Basic graph algorithms; adjacency matrices and lists; graph traversals - DFS
[slides]
References
  • Sections 3.1, 3.2 - [DPV]
  • Chapter 5 - Erickson
Tutorial #2
Wed 01/02
Discussion of Problem Sets 1 and 2
Mini quiz #1
Fri 03/02
Based on material covered in Problem sets 0, 1, 2
Lecture #9
Mon 06/02
BFS; finding connected components in graphs; digraphs - classification of edges
[slides]
References
  • Sections 3.2, 3.3 - [DPV]
  • Sections 6.1, 6.2 - Erickson
PS3 released
Lecture #10
Tue 07/02
DFS with clocks - classification of edges; Topological ordering of DAGs
[slides]
References
  • Section 3.3 - [DPV]
  • Section 6.3 - Erickson
Lecture #11
Wed 08/02
Digraphs and their strongly connected components; Finding and labelling the strongly connected components of a digraph
[slides]
References
  • Section 3.4 - [DPV]
  • Sections 6.5, 6.6 - Erickson
Tutorial #3
Fri 10/02
Discussion of Problem set 3
Lecture #12
Mon 13/02
Finding and labelling strongly connected components - Kosaraju-Sharir algorithm; Shortest paths in graphs - BFS
[slides]
References
  • Sections 3.4,4.2 - [DPV]
  • Sections 6.6,8.4 - Erickson
PS4 released
Lecture #13
Tue 14/02
Shortest path in unweighed graphs - BFS (contd); Shortest paths in DAGs
[slides]
References
  • Sections 4.2,4.7 - [DPV]
  • Sections 8.4,8.5 - Erickson
Lecture #14
Wed 15/02
Shortest path in graphs - Dijkstra's algorithm
[slides]
References
  • Section 4.4 - [KT]
  • Section 4.4 - [DPV]
  • Section 8.6 - Erickson
Tutorial #4
Fri 17/02
Discussion of Problem set 4
Lecture #15
Mon 20/02
Shortest path in graphs - Dijkstra's algorithm (contd), Bellman-Ford algorithm
[slides]
References
  • Section 4.4 - [KT]
  • Section 4.4 - [DPV]
  • Sections 8.6,8.7 - Erickson
Quiz #1
Tue 21/02
Based on material covered till Mon Feb 13
Lecture #16
Wed 22/02
Bellman-Ford algorithm (contd)
[notes]
References
  • Section 8.7 - Erickson
Lecture #17
Fri 24/02
Greedy algorithms - interval scheduling
[notes]
References
  • Section 4.1 - [KT]
Lecture #18
Mon 27/02
Greedy algorithms - scheduling jobs to minimize delays; exchange arguments
References
  • Section 4.2 - [KT]
PS5 released
Lecture #19
Tue 28/02
Greedy algorithms - scheduling jobs to minimize delays; exchange arguments; greedy vertex cover
[notes]
References
  • Section 4.2 - [KT]
Lecture #20
Wed 01/03
Huffman coding - optimal prefix codes and binary trees
[notes]
References
  • Section 4.8 - [KT]
Tutorial #5
Fri 03/03
Discussion of Problem set 5
Lecture #21
Mon 06/03
Huffman coding - algorithm and proof of correctness
[notes]
References
  • Section 4.8 - [KT]
PS6 released
Lecture #22
Tue 07/03
Huffman coding - implementation details; Minimum spanning trees - cut property
[notes]
References
  • Sections 4.5, 4.8 - [KT]
  • Section 7.1 - Erickson
Mini quiz #2
Fri 10/03
Based on Problem sets 5 and 6
Lecture #23
Mon 13/03
Minimum spanning trees - proof of the cut property; Boruvka's algorithm
[notes]
References
  • Sections 7.2, 7.3 - Erickson
PS7 released
Lecture #24
Tue 14/03
Prim's and Kruskal's algorithms - examples, implementation details, running time
[notes]
References
  • Sections 7.4, 7.5 - Erickson
Lecture #25
Wed 15/03
Kruskal's algorithm - amortized analysis; data structures for disjoint sets
[notes]
References
  • Section 7.5 - Erickson
Tutorial #6
Fri 17/03
Discussion of Problem set 7
Quiz #2
Tue 21/03
Based on material covered through Problems sets 5,6,7
Lecture #26
Fri 24/03
Union-by-rank with path compression; Amortized analysis - accounting method
[notes]
References
  • Section 5.1.4 - [DPV]
Lecture #27
Mon 27/03
Union-by-rank with path compression - amortized analysis
[notes]
References
  • Section 5.1.4 - [DPV]
Lecture #28
Tue 28/03
Dynamic programming - text segmentation
[notes]
References
  • Sections 3.3, 3.4 - Erickson
Lecture #29
Wed 29/03
Dynamic programming - text justification, edit distance
[notes]
References
  • class notes
PS8 released
Tutorial #7
Fri 31/03
Discussion of Problem set 8
Lecture #30
Mon 03/04
Dynamic programming - edit distance; saving space using divide-and-conquer
[notes]
References
  • Section 3.7 - Erickson
  • Sections 6.6, 6.7 - [KT]
Lecture #31
Wed 05/04
Dynamic programming - edit distane (contd.); 0-1 Knapsack - pseudopolynomial-time algorithm
[notes]
References
  • Sections 6.6, 6.7 - [KT]
Online lecture - video link on Zulip
Lecture #32
Mon 10/04
0-1 Knapsack - pseudopolynomial-time algorithm (contd.); Dynamic programming on trees - independent sets
[notes]
References
  • Section 3.10 - Erickson
Lecture #33
Tue 11/04
All Pairs Shortest Paths (APSP) - Johnson's algorithm; Dynamic programming based algorithms
[notes]
References
  • Sections 9.4, 9.5, 9.6 - Erickson
Lecture #34
Wed 12/04
Floyd-Warshall algorithm; APSP and matrix multiplication
[notes]
References
  • Sections 9.7, 9.8 - Erickson
Lecture #35
Mon 17/04
APSP and matrix multiplication - Seidel's algorithm; Introduction to computational intractability
[notes]
References
PS9 released
Lecture #36
Tue 18/04
Introduction to intractability - P and NP; poly-time solving versus poly-time verification
[notes]
References
  • Sections 34.1, 34.2 - [CLRS]
  • Sections 12.1, 12.2 - Erickson
Lecture #37
Wed 19/04
Polynomial-time reductions - NP completeness, examples of reductions
[notes]
References
  • Chapter 12 - Erickson
Mini quiz #3
Fri 21/04
Based on Problem set 8
Lecture #38
Mon 24/04
NP-completeness - examples of reductions
[notes]
References
  • Chapter 12 - Erickson
PS10 released
Lecture #39
Tue 25/04
Beyond NP-completeness - brief overview; Wrap-up of the course
Mini quiz #4
Wed 26/04
Based on Problem set 9
No matching items