CS 374 A, Fall 2025

Labs


Handouts and Solutions

Wed Aug 27
Lab 1a: String induction [solutions] [induction notes] [helpful advice on writing proofs]
Fri Aug 29
Lab 1b: Regular expressions [solutions]
Wed Sep 3
Lab 2a: DFAs [solutions]
Fri Sep 5
Lab 2b: DFA product construction [solutions]
Wed Sep 10
Lab 3a: Proving nonregularity [solutions]
Fri Sep 12
Lab 3b: Regular expression to NFA to DFA (to regular expression) [solutions]
Wed Sep 17
Lab 4a: Language transformations [solutions]
Fri Sep 19
Lab 4b: Context-free grammars [solutions]
Wed Sep 24
Lab 5: More language transformations [solutions]
Fri Sep 26
Review for Midterm 1

Wed Oct 1
Lab 6a: Hint: Binary search [solutions]
Fri Oct 3
Lab 6b: Fun with Karatsuba [solutions]
Wed Oct 8
Lab 7a: Backtracking [solutions]
Fri Oct 10
Lab 7b: Dynamic programming [solutions]
Wed Oct 15
Lab 8a: More dynamic programming [solutions]
Fri Oct 17
Lab 8b: Return of the son of revenge of dynamic programming [solutions]
Wed Oct 22
Lab 9a: Graph modeling [solutions]
Fri Oct 24
Lab 9b: Topological sort [solutions]
Wed Oct 29
Lab 10a: Shortest paths [solutions]
Fri 🎃ct 31
Lab 10b: All-pairs shortest paths [solutions]
Wed Nov 5
Lab 11: Solve it both ways [solutions]
Fri Nov 7
Review for Midterm 2

Wed Nov 12
Lab 12a: Reductions [solutions]
Fri Nov 14
Lab 12b: NP-hardness proofs [solutions]
Wed Nov 19
Lab 13a: More NP-hardness proofs [solutions]
Fri Nov 21
Lab 13b: Even more NP-hardness proofs [solutions]
Wed Nov 26
No lab — Thanksgiving break
Fri Nov 28
No lab — Thanksgiving break
Wed Dec 3
Lab 14a: Yet even still more NP-hardness examples [solutions]
Fri Dec 5
Lab 14b: Using Rice's Theorem [solutions]
Wed Dec 8
Review for the final exam

About Labs


Each student must register for one of five biweekly lab sections, which meet every Wednesday and Friday. As with lectures, lab attendance is strongly encouraged, but not mandatory.

At least during the first few weeks of the semester, please attend only the lab sections for which you are officially registered. Students who want to swap labs with another student should contact one of the TAs.

The labs are opportunities for you to develop your problem-solving and presentation skills. In each lab meeting, the course staff and the students will work on a small set of closely related problems, usually similar to problems in the current week's homework.

In a typical lab meeting, after giving the students a few minutes to read and understand the problems, the TA walks through the process of solving the first problem on the lab handout, with suggestions from the students. Then the students break into groups of 3–5 to work on the remaining problems, with feedback and suggestions from the course staff and from each other. At the end of the meeting, the TA quickly walks through the solutions to the remaining problems, with help from the students.

If necessary, the TAs may also spend a few minutes reviewing material from past lectures or prerequisite courses, but labs are not intended to be a substitute for the lectures. We assume that students at each lab have attended previous lectures (or at least watched the videos) and read the appropriate portions of the textbook / lecture notes.

Lab handouts a posted to the course web site (both here and on the week-by-week schedule) at the beginning of each week. We strongly encourage you to look at the problems beforehand and to continue working on them after your section ends. In particular, we strongly encourage discussion of lab problems on Ed Discussion after each lab session; students who post correct solutions or insightful hints for lab problems will get some extra credit. The course staff also will answer questions, provide hints, and give feedback on proposed solutions in office hours.

The point of the labs is to practice hunting (problem solving), not to acquire more meat (solutions). Our main job is to give you guidance in how to solve problems—how to track the wily inductive hypothesis, what bait best attracts fooling sets, how to sound the mating call of the dynamic programming recurrence, how to protect yourself from a swarm of angry vertices, how to safely build a trap for an undecidability proof—not just to show you answers.

That said, we also post solutions to each lab a day or two afterward, so that you can evaluate the results of your hunt. But don't make the mistake of thinking that you can learn to solve problems by reading (or worse, memorizing) solutions. The only way to learn to solve problems is to practice solving problems.