Description. This course is an introduction to computer science in the context of scientific, engineering, and commercial applications. The goal of the course is to teach basic principles and practical issues, while at the same time preparing students to use computers effectively for applications in computer science, physics, biology, chemistry, engineering, and other disciplines. Topics include: programming in Java; hardware and software systems; algorithms and data structures; fundamental principles of computation; and scientific computing, including simulation, optimization, and data analysis.

Prerequisites. None.

Textbook. R. Sedgewick and K. Wayne, Computer Science: An Interdisciplinary Approach, Addison–Wesley Professional, 2016. ISBN 978-0134076423. We will be referencing this text all semester. The lectures are based on its contents. The hardcopy version of the textbook is available from: Labyrinth Books. An online version is available via the Princeton Library. Go to Princeton's Safari Tech Books Online. Then visit the online book link.

Please note that errata for the textbook can be found here.


Lectures are provided as studio-produced videos. You should definitely watch lecture before lab and precept so that you are well-prepared.

Live Meetings

COS 126 officially has two lecture time slots reserved by the registrar.

While COS 126 lectures are recorded, we will use these times slots for a few live meetings:

Labs and Precepts


Labs meet Tuesdays and Thursdays for fifty (50) minutes. Each lab is a self-paced section, and involves working with a partner on interactive exercises and problem sets. Each lab is supervised by a facilitator to answer your questions.


Precepts meet Fridays for about forty (40) minutes. Working within a small group, your preceptor will review key learning objectives for the week's lectures and lab exercises. The precept will involve question and answer, group discussion, etc.


Course grades. Course grades are based on

There is no curve: you must earn, at a minimum, 93.0% of the available points for an A, 90.0% for an A–, 87.0% for a B+, 83.0% for a B, 80.0% for a B-, 77.0% for a C+, 73.0% for a C, 70.0% for a C-, or 60.0% for a D. You will fail the course if you earn below 60.0% of the available points.

Midterm exams. There are two two-part exams during the semester. The exams have a written portion and a programming portion. There is no final exam. No makeup exams will be considered without a Dean's recommendation and our approval in advance.

The exam dates are:

Programming assignments. There are ten programming assignments, all equally weighted. You may drop one one programming assignment. However you may not drop the first programming assignment or the final project.

Late work. Assignments are due on Sunday nights at 11:59pm. Submissions made at 12:00am will be marked late. If any part of an assignment is submitted late, the entire assignment will be marked late. To submit an assignment late, mark the checkbox on our online submission system (i.e., TigerFile) that indicates that your work is incomplete. If the deadline has passed and the checkbox is not marked, we will grade submitted work as-is.

Penalties for late work. Late assignments are assessed a penalty equal to 20% of the possible points on the assignment per day or partial day late. The penalties for your first four late days are automatically waived. Additional late penalties will be waived only in the case of unforeseeable circumstances like medical emergencies, as documented by your Dean or Director of Studies.

Final project. The final project is a large programming project, approximately the length of two programming assignments. It is due on Dean's Date at 5:00pm. You may not use late days on the final project. We will not accept any work after Dean's Date without a Dean's recommendation.

Regrades. If you feel a mistake has been made grading your work, please use the regrade request features of codePost (programming assignments, programming exams) or GradeScope (written exams). Regrade requests must be submitted within three (3) days of your work being returned.

Collaboration Policy

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

COS 126

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.

All the rules above continue to apply after assignments are graded and after the end of the semester.

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

Collaboration with classmates. We encourage you to discuss common concerns with classmates either private via personal interactions or publicly in the Ed Discussion course 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 interpret an error message. For example, "What does StackOverflowError mean?"
  • How to use a feature in IntelliJ. For example, "How do I start the embedded terminal?"
  • Clarifications for the lecture videos, lecture slides, textbook, old exam questions, or the assignment specifications.
  • Look at another classmate's solutions (or show another classmate your solutions).
  • Lead a classmate step-by-step through any part of the assignment (or allow a classmate to lead you step-by-step through any part of the assignment).

Collaboration with students who have already taken COS 126. Anyone who successfully completed COS 126 in a previous term, including lab TAs and peer tutors, may assist you in the following ways:

Collaboration with a partner. On certain assignments the collaboration policy is relaxed to allow working with a partner, subject to the following rules:

Collaboration acknowledgment. You must acknowledge all collaboration (except for partner names on group assignments) in the readme.txt file for that week's assignment.


Plagiarism and abetting plagiarism are serious academic infractions. Programming is a creative work and the academic regulations that apply to plagiarizing prose also apply to plagiarizing code. Princeton's Rights, Rules, 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).

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, labs and precepts). If you do so, you must cite any code that you copy or adapt (with the exception of code that is included with the assignment).

Plagiarism detection. We use sophisticated software tools to detect plagiarism. For example, we compare each submission (including interim submissions) against a code database, which includes all submissions from this offering and previous offerings of the course. While we take no pleasure in bringing cases to the Committee on Discipline; it is our duty to keep the playing field level for the overwhelming majority of students who work very hard in this course and follow the rules.

Penalties. We refer alleged academic violations (including plagiarism and abetting plagiarism) to the Committee on Discipline. If found responsible, the typical penalty is an F as a course grade plus whatever penalty that the CoD imposes. (The typical CoD penalty for plagiarism is suspension from the University for at least one semester.) 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 intentional and serious).


Dr. Adam Finkelstein

Dr. Alan Kaplan

Dr. Soohyun Nam Liao

Dr. Jérémie Lumbroso

Kobi Kaplan
Course Administrator

Gregory Chan

Johan Ospina

Divya Raghunathan

Tara Shankar

Christina Shatford

Dr. Kathrin Stark

Ted Sumers

Dr. Esin Tureci

Noah Walsh

Beiqi Zou

Lab Facilitators. Richard Huang | Kartik Shah | Alexis Sursock | Shannon Heh | Nicholas Padmanabhan | Neyci Estefanía Gutiérrez Valencia | Robert Rubin | Maxwell Xu | Michelle Huang | Rafael Collado | Jasmine Zhang | Sidharth Bejugama | Danxian Liu | Ryan Eusebi

Undergraduate Grading Managers. Alex Baroody | Joseph Lou | Shayna Maleson | Sara Schwartz | Alik Zalmover.

Graders. Diamond Acharya | Abhinav Agarwal | Eesha Agarwal | Eric J. Ahn | Cosmin Andrei | Bill Ao | Ariel Bachman | AnneMarie G. Caballero | Dangely J. Canabal | Christopher Chiang | Joy Cho | Ewan Curtis | Seppe De Pauw | Vedant S. Dhopte | Julia Douvas | Diana Espindola | Domenic A. Ferreris | Jessica J. Fielding | Adam R. Gamba | Abiram Gangavaram | Ryan J. Gibbons | Neyci E. Gutierrez Valencia | Kenny Huang | Michelle Huang | Hervé Ishimwe | AJ Kawczynski | Katie L. Kolodner | Neha Anil Kumar | Mary E. Kumcheva | Monique Legaspi | Doris Li | Richard K. Li | Mandy Lin | Erin R. Macanze | Zaynab Masood | Khandaker Momataz | Jane N. Nguyen | Begum Ortaoglu | Yash Parikh | Hetvi Patel | Emmy T. Song | Advika Srivastava | Amisha Srivastava | Morgan L. Teman | Pranav R. Thatte | Eva R. Vesely | Ivy Wang | Sean Wang | Lois Wu | Coleman K. Yanagisawa | Haley H. Zeng | Anlin Zhang | Cheyenne Zhang.