Assignments

This page contains the programming assignments for this course. The assignment specification describes the technical requirements of the programming assignment; the checklist answers FAQs and provides advice for testing and getting started. Below the list of assignments, you will find the course policies regarding submission, lateness, grading, and collaboration. The assignment FAQ also contains important information common to all programming assignments.

# DUE LOGO ASSIGNMENT COLLABORATION LINKS
1 Monday
2/6
Percolation
Estimate the percolation threshold using union–find.
individual Checklist
Project
Submit!
2 Monday
2/13
Queues
Implement two collections using arrays and linked lists.
individual Checklist
Project
Submit!
3 Monday
2/27
Autocomplete
Find all terms beginning with a given prefix, sorted by weight.
partner Checklist
Project
Submit!
4 Monday
3/27
K-d Trees
Implement k-d trees with nearest neighbor search.
partner Checklist
Project
Submit!
Leaderboard
5 Monday
4/3
WordNet
Measure the relatedness of two nouns using the WordNet digraph.
partner Checklist
Project
Submit!
Leaderboard
6 Monday
4/17
Seam Carving
Implement a content-aware image resizing algorithm.
partner Checklist
Project
Submit!
Leaderboard
7 Monday
5/1
Burrows–Wheeler
Implement the Burrows–Wheeler algorithm for data compression.
partner Checklist
Project
Submit!
Leaderboard


Submission policy.  Submit your solutions electronically via the TigerFile submission system, using your Princeton NetID and password for authentication. You may resubmit files without penalty up until the submission deadline.

Submitting with a partner.  On assignments that permit working with a partner, you must register your partnership in TigerFile. Either partner may submit files. Both partners receive the same score.

Check all submitted files.  Clicking the Check All Submitted Files button checks the header, compiles your files, runs a battery of unit tests, and reports the results. You may click this button at most 10 times per assignment; if you are working with a partner, this limit applies to the group.

Acknowledgments file. All assignments must include a file named acknowledgments.txt, which includes your acknowledgement of original work (as specified in Rights, Rules, Responsibilities), any citations, along with the names and dates of those who provided help. Submitting the acknowledgments.txt file indicates that you have stopped working on your assignment and your submitted work is ready to be graded. Your assignment will not be graded unless you submit the acknowledgments.txt file.

Late submissions. Assignments are due at 11:59pm ET on Monday evenings. If any part of an assignment is submitted late, the entire assignment will be marked late. We consider your assignment submitted as soon as you submit the acknowledgments.txt file.

Penalties for late submissions. Late assignments are assessed a penalty equal to 10% of the possible points on the assignment per day (or partial day) late. The penalties for your first four late days are waived automatically. To request an extension beyond that (e.g., for illness, travel, or religious observance), post in the appropriate Ed Discussion forum.

Penalties for submission mistakes. If you make a submission mistake, you can request a regrade with a penalty of 10%. Examples of submission mistakes include: submitting an incorrect version of a file forgetting to submit the readme.txt file, and forgetting to submit the acknowledgments.txt file.

Extra credit.  Some assignments have (optional) parts designated as extra credit. The policies for submission and collaboration are the same as for the required parts of the assignment.

Classwide competitions.  On some assignments, you may (optionally) submit your code to a classwide competition. We will time your programs and display the results in a public leaderboard. To enter the competition, submit your code along with a file nickname.txt. Whatever you put in nickname.txt will be used as your alias in the leaderboard. There is no official reward for doing well in the competition.

Coursera policy.  You are not permitted to use the Coursera autograders from Algorithms, Part I or II.

Grading policy.  Your code will be graded for correctness, efficiency, clarity, and style. It is your responsibility to describe how you have completed the assignment, not ours to glean this information from your code. Partial credit is available for a partially complete assignment (provided that the code compiles); just explain the situation in your readme.txt file. Graded work will be returned electronically through codePost.

Collaboration policy.  This course permits and encourages many forms of collaboration, including from course staff, classmates, and lab TAs. However, you must be careful to collaborate only as authorized below. Here is an executive summary.

activity your partner course staff COS 226 alums class-mates AI chatbots other
discuss concepts with ...
acknowledge
collaboration with ...
expose solutions to ... no no no
view solutions from ... no no no no no
plagiarize code from ... no no no no no no

Your solutions.  You must individually compose all of your solutions. The term solutions refers to any of the products created when completing a programming assignment, such as source code (including comments) and the readme.txt file. It includes both finished and unfinished products, regardless of correctness or completeness.

These rules continue to apply even after the semester is over.

Collaboration with course staff.  You are welcome to discuss your solutions with course staff members (instructor and preceptors) in office hours or via a private post in the course discussion forum. Do not post or email us your code; instead, submit it via TigerFile.

Collaboration with classmates.  We encourage you to discuss common concerns with classmates either privately via personal interactions or publicly in the course discussion forum. These discussions must be kept at a general level, without exposing your solutions.
For example, you may discuss: But, you may not:
  • How to use a feature in IntelliJ or bash. For example, “How do I increase the memory available to Java?”
  • The definition of a piece of Java syntax. For example, “How do I implement the Iterable interface?”
  • Clarifications for the lectures, textbook, old exam questions, or assignment specifications.
  • Look at another classmate’s solutions.
  • Show another classmate your solutions.
  • Lead a classmate step-by-step through any part of the assignment
  • Allow a classmate to lead you step-by-step through any part of the assignment.

Collaboration with COS 226 graduates (including lab TAs and peer tutors).  You are permitted to show your solutions to anyone who has successfully completed COS 226. So, for example, you may receive help from lab TAs in debugging your code. Of course, you must still individually compose your solutions. So, for example, you may not allow another individual to write, type, or dictate code; lead you step-by-step through any part of the assignment; or communicate solutions (including their solutions from a previous offering). Other individuals may help you under these same conditions, provided they are not taking COS 226 now and never will in the future.

Collaboration with an AI chatbot.  You may not use AI composition software (such as ChatGPT or GitHub Copilot) to create or debug code.

Collaboration with a partner.  On those programming assignments designated as partner, the collaboration policy is relaxed to permit working with a classmate, subject to the following rules:

Both partners are responsible for understanding all parts of the submitted assignment and receive the same grade. You should discuss with your partner early on whether you expect to use late days (or attempt the extra credit).

Collaboration with yourself.  If you took COS 226 (or Algorithms, Part I or II from Coursera) during a previous offering, you may refer to your old programming assignment only if you wrote all of the code on your own in the previous offering (and you are not working with a partner in this offering). Though, in our experience, students who re-do all of the assignments from scratch are much more likely to succeed in the course, so this is what we strongly recommend.

Collaboration acknowledgement.  You must acknowledge all collaboration in the readme.txt file for that week’s assignment.

Outside sources and citations.  Copying or adapting code that is not yours is permitted only if it comes from the course materials (i.e., the course textbook, companion booksite, programming assignment specifications, checklists, lecture slides, lecture videos, and precepts). You must cite any code that you copy or adapt; the only exception to this rule is for code that appears in the assignment specification or checklist, which you may use without citation.

Plagiarism.  Programming is a creative work and the academic regulations that apply to plagiarizing prose also apply to plagiarizing code. Rights, Rules, and Responsibilities defines plagiarism as “the use of any outside source without proper acknowledgment.” It ranges from “verbatim copying” (e.g., cutting-and-pasting code) to “thorough paraphrasing” (e.g., changing variable names or rearranging code). We use sophisticated tools to flag similar programs and our teaching staff takes the issue very seriously.

Regret clause.  If you plagiarize code on a programming assignment in this course, you may resubmit the assignment (via email to the course instructor), adding proper acknowledgments. If you do so, you will receive a 0 on the assignment (for violating course policies). However, with proper acknowledgments, this would not be plagiarism, so we would not initiate a CoD case. Once a case has been submitted to the CoD, the matter is outside of our control and the regret clause cannot be invoked.

Penalties.  We refer alleged academic violations (including plagiarism and abetting plagiarism) to the Faculty–Student Committee on Discipline. If found responsible, the typical penalty is no credit for the work in question plus whatever penalty that the CoD imposes. (The typical CoD penalty for plagiarism is suspension from the University for one year.) Violators of course policies that are not adjudicated by the CoD will receive penalties based on the severity of the violation, ranging from a warning (for violations that are both unintentional and innocuous) to an F in the course (for violations that are both willful and serious).