Basic Algorithms, Fall 2024

Lectures: Tue/Thu 9:30-10:45 AM in WWH 312
Recitations: Fri 9:30-10:45 AM in Bobst LL138
Midterm (In-Class): October 24 Thu 9:30-10:45 AM in WWH 312
Final Exam: December 19 Thu 8:00-9:50 AM Location TBA

Instructor: Jiaxin Guan, Office Hours: Tue 2:00-4:00 PM in WWH 412.
Recitation Leader: Jiaming Li, Office Hours: Wed 3:00-4:00 PM in WWH 412.
Grader: Jianwei Zheng, Jayesh Khandelwal, Ying Liu
Contact: For any questions on any topic, large or small, public or private, please use Campuswire.

Announcements

12/5: A practice final is now avaialble. It has a similar format as the actual final. Solutions will be posted next week.
12/3: The last homework, Homework 11 [tex] is now out and is due on Gradescope by Wednesday 12/11, 10:00 PM ET.
12/3: Jiaxin's OH for this week will be moved to Thursday from 2PM to 4PM in WWH 412.

Course Information

Description

This course is about Algorithms: procedures for solving problems.

The goal of this course is to help you:

  • Acquire essential analytical skills necessary for understanding the efficiency and correctness of algorithms
  • Learn how to construct high-level abstractions for problems and how to design algorithms to solve them
  • Develop the ability to clearly and coherently communicate algorithmic designs and prove why they work
  • Prepare for tech interviews??

We will study various algorithms for classical problems such as:

  • Sorting
  • Graph Problems
  • Data Structures
We will also learn some general techniques for designing algorithms, such as:
  • Divide & Conquer
  • Greedy
  • Dynamic Programming
Disclaimer: This is a class about theoretical computer science. You will be expected to understand and write proofs. While we will write extensive pseudocode, there will be no programming component.

Prerequisites

Data Structures (CSCI-UA 102); Discrete Mathematics (MATH-UA 120); and either Calculus I (MATH-UA 121) or Mathematics for Economics I (MATH-UA 211).

Resources

Textbook: Introduction to Algorithms, 4th Edition, by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Cliff Stein. Available online via NYU Libraries.
Supplemental Text: Algorithm Design by Jon Kleinberg and Eva Tardos. See also the corresponding Lecture Slides by Kevin Wayne.

Have Questions? The best way to reach us for any question on any topic, large or small, public or private, is by posting on Campuswire. The teaching team will not respond to questions sent through emails.

Homework

There will be 11 written homework assignments, roughly on a weekly basis. Homeworks will be due at 10:00 PM ET on the specified deadlines.

Submission

Homeworks should be submitted in PDF form on Gradescope. We prefer homework submissions typeset in LaTex. If you are not familiar with LaTex, it is a great skill to learn. Overleaf provides a simple web interface for writing and compiling LaTex (as well as extensive documentation). For each homework assignment, we will provide the LaTex source file for you to edit from. You are encouraged to insert scanned figures or illustrations where appropriate. Scanned handwritten submissions will only be graded if perfectly legible. If you are unsure about your handwriting, I strongly suggest you type up your solutions.

Collaboration

We strongly encourage you to discuss assignments with your peers, but you must (a) list the names of your discussion partners on your submission, and (b) write up your solution on your own. You may not look at the written solutions of any other student before submitting your own solution. If you do not list the names of your collaborators, you will be penalized.

Regrade Requests

We do our best in this course to grade as accurately and as thoroughly as possible. We understand how important it is for your grades to be fair and correct. If there is an error, you're encouraged to submit a regrade request on Gradescope. Regrade requests must be submitted at most three days after that assignment/exam's grades are released. Regrade requests that are not polite or that take issue with the rubric design (as opposed to misapplication of the rubric as it is) may be closed without comment.

Late Policy

Late submissions of homework solutions will be graded with a 20% penalty per day of late submission. Solutions will not be graded if they are submitted more than two days after the specified deadline. To accommodate unforeseen personal circumstances, your two lowest homework scores will be dropped. No further extensions or accommodations will be granted, except under very rare circumstances.

External Resources

I encourage you to consult outside resources to deepen your understanding both of material we cover in class, and the many things we will (regrettably) not have time to cover. You must explicitly acknowledge any external resources consulted in your homework.

However, you are not allowed to consult any resource for the purpose of finding homework solutions. For example, you may not consult homework solutions for a previous version of this class. Violations to this policy is plagiarism and will not be tolerated.

Exams

There will be one in-class midterm exam and one final exam. Their time and location are as follows:

  • In-Class Midterm is Thursday, October 24, 9:30-10:45 AM in WWH 312.
  • Final Exam is Thursday, December 19, 8:00-9:50 AM location TBA.

Both exams will be closed-book and closed-notes. For the midterm, you are allowed one double-sided 8.5''x11'' page of note. For the final, you are allowed two double-sided 8.5''x11'' pages of note. The final exam will be cumulative, but with a slight focus on the materials covered in the second half of the semester. A practice exam will be released one week before each exam date.

Grading

Final placement in the class will be determined by the following formula:

0.3 H + 0.3 M + 0.4 F

where H is your average score on the homework assignments after dropping the lowest two, M is your midterm exam score, and F is your final exam score.


Applicable University Policies

Academic Integrity

Your work should be your own. Students should be aware of the CS Department's Policy on Academic Integrity. Violations of academic integrity will not be tolerated.

Religious Observance

As a nonsectarian, inclusive institution, NYU policy permits members of any religious group to absent themselves from classes without penalty when required for compliance with their religious obligations. The policy and principles to be followed by students and faculty may be found in the University Calendar Policy on Religious Holidays.

Disability Disclosure

Academic accommodations are available to any student with a chronic, psychological, visual, mobility, learning disability, or who is deaf or hard of hearing. Students should please register with the Moses Center for Students with Disabilities.

Date Topic Reading Homework*
Lecture 1 Tue 9/3 Intro, Stable Matching CLRS §25.2; KT §1
Lecture 2 Thu 9/5 Insertion Sort, Runtime Analysis, Asymptotics CLRS §1, §2.1, §2.2, §3;
Lecture 3 Tue 9/10 Asymptotics, Merge Sort, Divide and Conquer CLRS §3, §2.3, §4 HW1 [tex]
Lecture 4 Thu 9/12 Analysis of Merge Sort, Recurrence Relations CLRS §4
Lecture 5 Tue 9/17 Quick Sort CLRS §7 HW2 [tex]
Lecture 6 Thu 9/19 Karatsuba's Algorithm, Closest Pair in the Plane KT §5; CLRS §33.4
Lecture 7 Tue 9/24 Median and Order Statistics CLRS §9 HW3 [tex]
Lecture 8 Thu 9/26 Lower Bound for Comparison Sort CLRS §8.1
Lecture 9 Tue 10/1 Counting Sort, Radix Sort CLRS §8.2, §8.3 HW4 [tex]
Lecture 10 Thu 10/3 Dynamic Programming: Fibonacci Numbers, Rod Cutting Problem CLRS §14.1
Lecture 11 Tue 10/8 Dynamic Programming: Longest Common Subsequence CLRS §14.4 HW5 [tex]
Lecture 12 Thu 10/10 Dynamic Programming: Knapsack CLRS §15.2
------ Tue 10/15 Legislative Monday - No Class
Lecture 13 Thu 10/17 Greedy: Activity Selection CLRS §15.1 HW6 [tex] - Due 10/30
Lecture 14 Tue 10/22 Greedy: Huffman Code CLRS §15.3
Midterm Thu 10/24 In-Class Midterm Exam - Good Luck! Practice Midterm [solution]
Lecture 15 Tue 10/29 Greedy: Huffman Code CLRS §15.3 HW7 [tex]
Lecture 16 Thu 10/31 Graphs, BFS §20.1, §20.2
Lecture 17 Tue 11/5 BFS, DFS CLRS §20.2, §20.3 HW8 [tex]
Lecture 18 Thu 11/7 Edge Classification, Cycle Detection CLRS §20.3
Lecture 19 Tue 11/12 Cycle Detection, Topological Sort CLRS §20.3, CLRS §20.4 HW9 [tex]
Lecture 20 Thu 11/14 Strongly Connected Components CLRS §20.5
Lecture 21 Tue 11/19 Minimum Spanning Tree, Kruskal's Algorithm CLRS §21.1, §21.2 HW10 [tex]
Lecture 22 Thu 11/21 Prim's Algorithm CLRS §21.2
Lecture 23 Tue 11/26 Dijkstra's Algorithm CLRS §22.2, §22.3
------ Thu 11/28 Thanksgiving Recess - No Class
Lecture 24 Tue 12/3 Floyd-Warshall Algorithm CLRS §23.2 HW11 [tex]
Lecture 25 Thu 12/5 Computability, NP-Completeness CLRS §34
Lecture 26 Tue 12/10 Sneakpeek of Algorithmic Game Theory
Lecture 27 Thu 12/12 Final Review
Final Thu 12/19 8:00-9:50 AM Location TBA Practice Final

*Homework assignments are due on the following Wednesday unless otherwise noted.

Release Date Due Date Mean Median Std. Dev. Max
Homework 1 [tex] [submission] Tue 9/10 Wed 9/18 93.97 96.5 5.77 100.0
Homework 2 [tex] [submission] Tue 9/17 Wed 9/25 92.29 94.0 7.44 100.0
Homework 3 [tex] [submission] Tue 9/24 Wed 10/2 90.60 92.0 5.71 100.0
Homework 4 [tex] [submission] Tue 10/1 Wed 10/9 91.19 96.5 11.17 100.0
Homework 5 [tex] [submission] Tue 10/8 Wed 10/16 97.17 99.0 3.40 100.0
Homework 6 [tex] [submission] Thu 10/17 Wed 10/30 93.31 99.0 10.32 100.0
Homework 7 [tex] [submission] Tue 10/29 Wed 11/6 96.89 100.0 5.07 100.0
Homework 8 [tex] [submission] Tue 11/5 Wed 11/13 87.82 92.5 13.78 100.0
Homework 9 [tex] [submission] Tue 11/12 Wed 11/20 92.14 100.0 11.06 100.0
Homework 10 [tex] [submission] Tue 11/19 Wed 11/27
Homework 11 [tex] [submission] Tue 12/3 Wed 12/11