Every Wednesday evening, homework is posted on Piazza, and is due the following Wednesday by 4:59 PM. No late homeworks will be accepted for any reason.

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

How to Format Homework:
You can write your homework 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 @21 for tips on getting started. Each problem must start on a new page, and indicate the problem number. If a problem has multiple parts, they may be on the same page. You are encouraged to do homework in small groups; up to 4 students total. List your collaborators on the first page of your submission. If you have no collaborators, you must explicitly list "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:
Submit homework via Gradescope; we will not accept it via any other format. The Gradescope homework cutoff may be set later than 4:59 PM at our discretion, but this grace period does not change our official policy: if you encounter an issue at 5:01 PM 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 even submit an incomplete homework as backup, if you're working on the homework all the way up until the deadline.)

You may request a regrade request (through Gradescope) within one week of when we release homework grades. 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 solutions:
The staff posts detailed solutions of the homework problems each week, often with multiple solution approaches and commentary. Make it a priority to carefully read the solutions and compare them with your own work. Thoroughly understanding the solutions is a critical step to mastering the material. As an added incentive, we will draw from the homework problems when we write the exams.

Homework parties:
We will hold two weekly homework parties. First one will usually be Tuesday 5-7 pm in Cory 540 and second one will almost always be Friday morning 9-11 am in the Woz Lounge in Soda Hall. Homework party times will vary until the week of September 24th. Please check the course calendar for times and locations. Homework parties are completely optional.

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.

Redemption files:
It is important that you carefully read the posted solutions, even for problems you got right. To encourage this, you have the option of submitting a redemption file, a few paragraphs in which you explain, for each problem you choose to cover, what you did wrong and what the right idea was in your own words (not cutting and pasting from the solution!), and appending it to your homework. These will not be checked routinely, but we promise to look at them if they would make a difference in your grade (ie, you're close to a grade border). For example, as you review your solutions to HW1, you realize you had misunderstood question 3 and answered it incorrectly. You would write down what you just learned, and then submit it in your HW2 assignment the following week. Because these are mainly for your benefit, feel free to format them however is most useful for you.

Extra credit problems:
Do the extra credit problems only if you really enjoy working on these problems and want an extra challenge. It is likely not the most efficient manner in which to maximize your score.

Programming Project

Although most of the homework are theoretical, there will be one (or two) challenging but fun programming project(s). 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 - 9/28 8-9:30 pm
  • MT2 - 11/2 8-9:30 pm
  • Final - 12/15 7-10pm

All exams are mandatory. If you will be unable to attend any of the midterms, you must contact the instructors via Piazza within one week of the first lecture. We will not provide an alternative final exam.


We will compute grades from a weighted average, as follows:
  • Homeworks and Programming Projects: 20%
  • Midterm 1: 20%
  • Midterm 2: 25%
  • Final exam: 35%

here 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, as well as your redemption files 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 at most 4 other students. We encourage you to collaborate with your fellow students (in small groups) on 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
  • Using ideas from any external source without citing it.
  • Splitting up the problems; for example, "You solve the first three problems, I'll solve the last three problems, and we'll tell each other how to solve them."
  • Sharing your solutions, or partial solutions, with another student, even with the explicit understanding that they won't be copied or with students in your homework group.
  • Receiving help on homeworks from students who have taken the course in previous semesters.
  • Reviewing homework solutions from previous semesters.
  • Searching the Internet for a solution to the exact problem we gave you on a homework.

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 or C).

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: 
No cell phone, laptop, or other electronics use will be allowed in lecture: if you must use your phone or other device, please step outside. 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.

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.

Late homework policy: 
We will not accept homework after the deadline.  We may make a grace period on Gradescope, usually via the "late submission" feature, at our discretion. There is no penalty for turning in during the grace period, but once Gradescope cuts off submissions, we will not accept any more. Please don't ask for extensions. 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.

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:
    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.  Also, regardless of how well you did on the homework, read the sample solutions, even for the problems you got right. You may well learn a different way of looking at the problem, and you may also benefit from emulating the style of the solutions.
  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 is 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 (two to 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.