CS 218: Design and Analysis of Algorithms

Fall 2021

Catalog description

Study of efficient data structures and algorithms for solving problems from a variety of areas such as sorting, searching, selection, linear algebra, graph theory, and computational geometry. Worst-case and average-case analysis using recurrence relations, generating functions, upper and lower bounds, and other methods.


  • CS 141
  • Instructors

  • Stefano Lonardi, email
  • Zheqi Shen, email
  • Class Meeting

  • TR 2:00pm-3:20pm, Sproul 1102
  • Office hours

  • Stefano: Tuesdays 4-5pm via Zoom D 979 7541 4007, password in the slides
  • Zheqi: Tuesdays 7:30-8:30pm, via Zoom ID cs218oh.zheqi, same password used for Stefano's office hours
  • Required Texbook

  • Introduction to Algorithms (3rd Edition) by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Cliff Stein, MIT Press.
  • Prerequisites

  • Graduate standing, undergraduate courses in algorithms and data structures. Students without an undergraduate courses in algorithms (CS 141 equivalent) and basic data structures (CS 14 equivalent) will not allowed to enroll.
  • Prerequisites by topic

  • Discrete Math: asymptotic notation, basic summation formulas, sets (operations on sets, relations, functions), counting (permutations, sets, combinations, binomial coefficients), probability (independence, random variable, expected value)
  • Basic Data Structures: array, list, queue, stack, binary search trees, balanced binary search trees, heap
  • Sorting and Searching: quicksort, mergesort, heapsort, radix-sort, binary search
  • Graph algorithms: DFS, BFS, connected components, biconnected components, transitive closure
  • Digraph algorithms: DFS, BFS, strongly connected components, topological sorting
  • Preliminary list of topics

  • Intro to Analysis: recurrence relations, master theorem, lower bounds, amortized analysis
  • Divide and conquer: linear-time selection, FFT, integer multiplication
  • Randomized: selection in expected linear time, polynomial verification
  • Greedy: task scheduling, Dijkstra, Prim, Kruskal
  • Union-Find: list and tree implementation, union by rank and path compression, analysis
  • Dynamic programming: Subset sum, LCS, matrix chain multiplication, Floyd-Warshall
  • Graph algorithms: Network Flow and Bipartite Matching
  • Course Format

  • Entrance exam
  • Seven homework
  • Midterm exam
  • Final exam
  • Cheating

    We will not tolerate any kind of cheating in this course. Homework and final project are to be completed on your own. The only external sources allowed are those mentioned above or by the instructor throughout the course. If you have a doubt or question, please just ASK. As per standard UCR policy, you may not submit written answers to problem sets that contain material you did not produce yourself for the express purpose of this offering of this course. If I find that you have submitted work that is not your own or is work you submitted in a different course, I will assign you a zero on that assignment (and possibly a zero on the entire course, depending on the severity), and I will forward the case to Student Conduct and Academic Integrity Programs for campus-level consideration.


    Slides will be posted on Canvas.


    Grades will be posted on Canvas.

    Video recordings

    Video recordings will be posted on Yuja. Please login first into Canvas, then click on YuJa. You can also login directly into YuJa.


    Homework will be released on Canvas (go to Assignments). Homework should be prepared in LaTeX (figures can be hand-drawn), then converted/scanned to pdf format and turned in via Gradescope. A very good LaTeX editor is Overleaf. Each student's work should be fully authored by his or her self, in his or her own words - that is, each student should turn in only text authored by his or her self. Each student is responsible for understanding all text that they submit. Finally, in each turned-in work, each student should appropriately cite any help or ideas that came from any other source. Violation of this policy is plagiarism and will be referred to the UCR student conduct office.


    Week 0
  • R, Sep 23: Course overview, Analysis (1-24)
  • Week 1
  • T, Sep 28: Analysis (25-48) [Hw1 posted]
  • R, Sep 30: Analysis (49-60) [Entrance exam]
  • Week 2
  • T, Oct 5: Analysis (61-76) [Hw1 due, Hw2 posted]
  • R, Oct 7: Analysis (77-end), Divide and Conquer (1-16)
  • Week 3
  • T, Oct 12: Divide and Conquer (17-39) [Hw2 due, Hw3 posted]
  • R, Oct 14: Divide and Conquer (40-73)
  • Week 4
  • T, Oct 19: Divide and Conquer (74-end) [Hw3 due]
  • R, Oct 21: Prep for midterm I
  • Week 5
  • T, Oct 26: [Midterm I, Hw4 posted]
  • R, Oct 28: Greedy (1-35)
  • Week 6
  • T, Nov 2: Greedy (36-57)
  • R, Nov 4: Greedy (57-78) [Hw4 due, Hw5 posted]
  • Week 7
  • T, Nov 9: Greedy (79-end), Dynamic Programming (1-25)
  • R, Nov 11: Campus holiday - Veterans Day [Hw5 due, Hw6 posted]
  • Week 8
  • T, Nov 16: Dynamic Programming (26-)
  • R, Nov 18: Dynamic Programming (-end), Prep for Midterm II [Hw6 due]
  • Week 9
  • T, Nov 23: [Midterm II, hw7 posted]
  • R, Nov 25: Campus holiday - Thanksgiving
  • Week 10
  • T, Nov 30: Flow Network (1-34)
  • R, Dec 2: Flow Network (35-end), Prep for Final [hw7 due]
  • Finals' Week
  • Final: Wed, Dec 8, 8:00-11:00AM in class