Every Monday evening, homework is posted on Piazza, and is due the following Monday by 11:59 PM. No late homeworks will be accepted for any reason. We don't mean to be harsh, but we prefer to make model solutions available shortly after the due date, which makes it impossible to accept late homeworks.

This policy aims to be fair and objective towards all students. We will, however, drop your two lowest homework scores. Please avoid skipping homeworks, saving your drops in case a true emergency or crisis arises. (Though note that a project due at the end of the semester cannot be dropped.)

How to Format Homework:

You can write your homework in one of the following ways:

  1. Typeset your answers using LaTeX.
  2. Type your answers using a mainstream word processor.
  3. Neatly handwrite, then use a flatbed scanner or smartphone app (such as CamScanner) to produce a PDF. Do not simply take a photo and dump it into a PDF.

We strongly recommend LaTeX; see Piazza @XX for tips on getting started.

The readers work hard to grade your homeworks in a timely manner, and with useful feedback. Given the size of the course, we require a certain format of all homeworks: each problem must start on a new page, and clearly display the problem number; if a problem has multiple parts, make sure that each part fits on a page.

You are encouraged to do homework in small groups (e.g. of four students.) List your collaborators on the first page of your submission. If you have no collaborators, you must explicitly write "none."

How to Respond to Algorithm Problems:

Oftentimes, a problem will ask you to "give/design/devise/formulate/create/etc. an algorithm" or to "show how" to solve some computational task. In this case, write your solution in the 4-part algorithm format detailed here.

How to Submit Homework:

Homework must be submitted via Gradescope. If you encounter an issue at 11:59PM and Gradescope doesn't let you submit the homework, it will not be accepted. Thus, you should submit your homework well in advance to reduce the risk of technical issues. (You can simply submit an incomplete homework as backup, if you're working on the homework all the way up until the deadline.)

Office Hours:

TA office hours are for homework- and midterm-related questions, or minor concerns. Prof. Chiesa’s and Prof. Vazirani’s office hours are for major concerns or high-level questions about the course material. Please note that on Tuesdays and Wednesdays, Office Hours will prioritize conceptual questions over homework questions.


You may request a regrade (through Gradescope) within one week of when homework grades are released. Read the solutions carefully beforehand, and request a regrade only if you were graded inconsistently with the rubric. Make sure to clearly and politely explain why your solution was graded incorrectly. We reserve the right to regrade the whole homework assignment when you request a regrade, which could cause your score to change in either direction.

Homework parties:

We will hold two weekly homework parties: Wednesdays 6-9PM in Cory 540 and Fridays 2-5PM in the Wozniak Lounge in Soda Hall. Homework parties are completely optional, but are strongly encouraged. This is an opportunity to find a group of other students to work together on the homework. Students are expected to form ad-hoc "pickup" homework groups, in the style of a pickup basketball game, and help others in their group. Most students do better at and learn more from the homework when they work in groups, and the HW party is a great opportunity to meet homework partners. In addition, course staff will be present to answer questions and help you. If the room is crowded, please, be kind and make room for others by leaving if you can find an alternative source of assistance. When the room is not crowded, people from the class are welcome to just hang out as long as they aren't bothering other people. For us to be able to continue to offer this service, you all have to be very responsible in taking care of the room, not make a mess, and put things back the way they were before you leave.

Programming Project

Although most of the homeworks are theoretical, there will be one challenging but fun programming project. Programming projects cannot be dropped. Details will be decided and announced when that time approaches.


There will be two midterms and one final exam.

  • MT1 - 2/13 3:30-5PM
  • MT2 - 3/20 3:30-5PM
  • Final - 5/11 7-10PM

All exams are mandatory. Midterms are during class time, and all students are expected to be able to attend them. We will not provide any alternate exams.

Please note that students need instructor permission to be enrolled in CS170 and any other class whose lecture time conflicts with CS170, even if the conflicting course is willing to offer alternate exams or does not have any final exams. To request an exception, please fill out the following form (https://goo.gl/forms/KOYFp1z63SghYzHA2).


We will compute grades from a weighted average, as follows:

  • Homeworks: 15%
  • Programming Project: 5%
  • Midterm 1: 20%
  • Midterm 2: 25%
  • Final exam: 35%

There is no clobbering policy for exams. We will drop the two lowest homework scores. We may take into account participation in Piazza, discussion, office hours, and HW party, and the trendline (looking favorably upon a student who showed improvement between midterms 1 and 2, and the final) if a student's grade is on the borderline between two grade categories. The class will be curved at the very end of the semester.


For each homework, you may collaborate with other students in small study groups (e.g. of four students). We encourage you to collaborate with your study groupon the homeworks. If you don't have a group to work with, come to the homework parties and form one! Clarifying concepts and discussing possible approaches to problems are good forms of collaboration. However, you must write up all solutions on your own, without ever looking at or copying any other student's solutions. If you are tempted to look at someone else's solutions (this includes over the Internet), keep in mind that the exams carry much more weight than the homeworks, and there is a strong correlation between students' exam scores and the effort they put into the homework.

Cheating on homeworks or exams will be taken seriously. We refer you to the department's policy on academic dishonesty and the campus honor code. In particular, keep the following in mind:

  • Give credit. You must list any students you worked with, as well as other sources of information you used, on the first page of your homework.
  • Don't share solutions. Working together means clarifying concepts and discussing possible approaches. Never look at any part of someone else's solution (including online) and never share any part of your own work with another student.
  • When in doubt, ask. If you're not sure whether a particular situation constitutes cheating, ask a TA or the instructor.

To be clear, the following behaviors are cheating:

  • Telling someone who is not in your homework group how to solve a homework problem
  • Sharing partial or complete written solutions with any student (even with those within your study group).
  • Looking online or asking anyone for solutions to same or similar homework problems from previous semesters.
  • Receiving help on homework from students who took the course in previous semesters.

We expect that most people can distinguish legitimate collaboration from cheating, but here are some more details. No matter what, you must write up your solutions entirely on your own. For homeworks, you must never read, see, or copy the solutions of other students, and you must not allow other students to see your solutions. You must never share your solutions, or partial solutions, with another student -- not even with the explicit understanding that they won't be copied; not even with students in your homework group. You must not receive help on homeworks from students who have taken the course in previous years. You must not review homework solutions from previous years. You must not search the Internet for a solution to the exact problem we gave you on a homework. The only way to learn algorithms to practice, practice, practice, so we want you to solve the problems on your own, not rely on other sources as a crutch.

You must ensure that your solutions will not be visible to other students. If you use Github or another source control system to store your solutions electronically, you must ensure your account is configured so your solutions are not publicly visible. If you use Github, Github offers free student accounts that allow you to keep your solutions private; please use one.

Course Policies


All announcements will be posted to Piazza. You are responsible for staying up-to-date with announcements made on Piazza.

Contact information:

If you have a question, the best way to contact us is via Piazza. The staff (instructors, TAs, and readers) will check the site regularly, and if you use it, other students will be able to help you too. However, be very careful when asking about homework to avoid posting potential answers or hints. If in doubt, mark your question as private.

If your question is personal or not of interest to other students, mark it as private on Piazza. If you wish to talk with one of us individually in person, you are welcome to come to any of our office hours.


The prerequisites for CS 170 are CS 61B and CS70. You will need to be comfortable with mathematical induction, big-O notation, basic data structures, and programming in a standard imperative language (e.g., Java/C/Python).


The required textbook is Algorithms (Dasgupta, Papadimitriou, and Vazirani) as our textbook. All chapter numbers and exercise numbers in this course refer to the official paper textbook, not the online version.

Electronics Policy:

Students may use laptops and other electronics in the class. But if you do so, please sit only in the rows at the back of the class, so as to not disturb anyone else. Academic studies have shown that students learn better when taking notes by hand rather than through a keyboard. The fact that it's impossible to write down everything the professor says is a feature, not a bug: it helps you learn by synthesizing the most important information. There are also studies showing that using your laptop during lecture will distract not only you, but also your neighbors, much like second-hand smoke. The sources below are taken from an article by Prof. Susan Dynarski, from the University of Michigan, which can be found online.

  1. Pam A. Mueller and Daniel M. Oppenheimer, “The Pen Is Mightier Than the Keyboard,” Psychological Science, Vol 25, Issue 6, pp. 1159 - 1168. First published date: April-23-2014. http://journals.sagepub.com/doi/abs/10.1177/0956797614524581
  2. Faria Sana, Tina Weston, Nicholas J. Cepeda, “Laptop Multitasking Hinders Classroom Learning for Both Users and Nearby Peers,” Computers & Education, Volume 62, 2013, Pages 24-31. http://www.sciencedirect.com/science/article/pii/S0360131512002254?via%3Dihub
  3. Susan Payne Carter, Kyle Greenberg, Michael S. Walker, “The Impact of Computer Usage on Academic Performance: Evidence from a Randomized Trial at the United States Military Academy,” Economics of Education Review, Volume 56, 2017, Pages 118-132, http://www.sciencedirect.com/science/article/pii/S0272775716303454. The What Works Clearinghouse has reviewed this study and given it its highest rating: https://ies.ed.gov/ncee/wwc/Docs/SingleStudyReviews/wwc_carter_022217.pdf.

Discussion sections:

Attendance at discussion sections is expected, and sections may cover important material not covered in lecture. You may attend any discussion section, regardless of your registration. Outside of your discussion section, you should feel free to attend any of the staff office hours (not just your section TA's office hours) and ask any of us for help.

Re-grading policies:

Regrading of homeworks or exams will only be undertaken in cases where you believe there has been a genuine error or misunderstanding. Any requests for grade changes or re-grading must be made within one week of when the work was returned. Submit re-grade requests via Gradescope. Bear in mind that our primary aim in grading is consistency, so that all students are treated the same; for this reason, we will not adjust the score of one student on an issue of partial credit unless the score allocated clearly deviates from the grading policy we adopted for that problem.

Extra credit opportunities:

The instructor reserves the right to offer optional activities that provide a small number of extra credit, for those eager for a tougher challenge. We recommend you do them only if you enjoy these problems, as spending effort on them is likely not the most efficient way to maximize your final course grade.

Don't be afraid to ask for help:

Are you struggling? We'd much rather you approached us for help than gradually fall behind over the semester until things become untenable. Sometimes this happens when students are afraid of an unpleasant conversation with an instructor if they admit to not understanding something. We would much rather deal with your misunderstanding early than deal with its consequences later. Even if you are convinced that you are the only person in the class that doesn't understand the material, and that it is entirely your fault for having fallen behind, please overcome your feeling of guilt and ask for help as soon as you need it. Remember that the other students in the class are working under similar constraints -- they are taking multiple classes and are often holding down outside employment. In past semesters, TAs have met with many students for many reasons, like working through test-taking stress or getting extra help on specific topics. Don't hesitate to ask us for help -- helping you learn the material is what we're paid to do, after all!


The following tips are offered based on our experience with CS 170:

  1. Don't fall behind!

    In a conceptual class such as this, it is particularly important to maintain a steady effort throughout the semester, rather than hope to cram just before homework deadlines or exams. This is because it takes time and practice for the ideas to sink in. Make sure you allocate a sufficient number of hours every week to the class, including enough time for reading and understanding the material as well as for doing assignments. (As a rough guide, you should expect to do at least one hour of reading and two hours of problem solving for each hour of lecture.) Even though this class does not focus on projects, you should plan to spend as much time on it as your other technical classes.

  2. Do the homeworks, and go over homework solutions:

    The effort you spend on the homework assignments is the largest factor in your mastery of the material, and thus performance in the class as a whole. The staff posts detailed solutions of the homework problems each week, often with multiple solution approaches and commentary. Regardless of how well you did on the homework, make it a priority to carefully read the solutions and compare them with your own work, even for the problems you got right. The main reason to do so is that sample solutions will often be simpler and cleaner. You will have a higher chance of solving similar problems under exam pressure if you have a simple picture. You may well learn a different way of looking at the problem, and you may also benefit from emulating the style of the solutions. It might seem attractive in the short term to just ignore homework solutions, or delay reading them until the day before the final. Some students will even try to finish the homework faster by looking up solutions to problems online. But these practices are detrimental to understanding in the long term, and thoroughly understanding solutions is a critical step to mastering the material. These homeworks are provided to you not as a chore, but as an opportunity for you to challenge yourself and explore the wonderful world of algorithms. Don’t short-change yourself by skimping on them. As an added incentive, we will draw from the homework problems when writing exams.

  3. Don't wait until the last minute to start homeworks!

    Read through the homework problems as soon as they are available, and let them percolate in your brain. Schedule multiple times throughout the week to attempt the problems. Often, the solution will only come to you the second or third time you try a problem. Definitely do not wait until the night before it is due to start working on the homework. If you do this (alas, procrastination is all too common), (a) the stress will make it harder to be creative and solve the problems; (b) you will be tempted to ask your homework group for too many hints (or outright solutions) to the problems, which borders on cheating and impedes your learning, and (c) the stress will sap the joy of finding algorithms!

  4. Make use of office hours and discussion sections:

    The instructor and TAs hold office hours expressly to help you. You are free to attend as many office hours as you wish (you are not constrained just to use the office hours of your section TA). Discussion sections are an opportunity for interactive learning. The success of a discussion section depends largely on the willingness of students to participate actively in it. As with office hours, the better prepared you are for the discussion, the more you are likely to get out of it.

  5. Form study groups!

    As stated above, you are encouraged to form small groups (e.g. of four students) to work together on homeworks and on understanding the class material on a regular basis. In addition to being fun, this can save you a lot of time by generating ideas quickly and preventing you from getting hung up on some point or other. Of course, it is your responsibility to ensure that you contribute actively to the group; passive listening will likely not help you much. And recall the caveat above that you must write up your solutions on your own. Spend some time on your own thinking about each problem before you meet with your study partners; this way you will be in a position to compare ideas with your partners, and it will get you in practice for the exams.