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.

Undergraduate coordinator. For enrollment problems, contact Colleen Kenny-McGinley.

Lectures. Lectures meet twice a week, on Tuesday and Thursday mornings. There are two lecture sections, one meeting at 10:00am, the other at 11:00. Both meet in Friend 101.

Precepts. Precepts meet twice a week, on either Tuesdays & Thursdays or Wednesdays & Fridays. There are 21 precepts running this semester!

Readings. Both of these books are available at Labyrinth Bookstore (Intro. to Prog. in Java, Computers Ltd.) and on reserve at the Engineering Library in the Friend Center.

Required reading. R. Sedgewick and K. Wayne, Introduction to Programming in Java: An Interdisciplinary Approach, Addison-Wesley, 2007. ISBN 0-321-49805-4. We will be referencing this text all semester. The lectures are based on its contents.

Suggested reading.D. Harel, Computers Ltd.: What They Really Can't Do, Oxford, 2003. ISBN 0-19-860442-4. This is an introduction to theory that will be useful in the second half of the semester.


This site. The website you're currently reading contains a wealth of documents and online tools for you to practice and study computer science, including the course lecture slides, online programming activities (with solutions), a Java code visualizer, and an archive of the past ten semesters' worth of exams in this course, also with solutions. A quick way to get back to this page is to type:

Booksite. As a reference to the required textbook for this course, we provide a companion website that has extra exercises and plenty of reference material so you won't have to dig though the textbook for syntax. That said, it is not a replacement for the physical book. The book is the only place to find a detailed explanations of the course curriculum. You will be responsible for a carefully reading of its contents on written exams.

Piazza. Piazza is an online forum where you can ask questions anonymously and get an answer from the COS 126 staff rather quickly. You can also read your fellow students' anonymous questions and the staff responses. We recommend reading Piazza a couple times per week to ensure that you are keeping up with your peers.

Blackboard. We use Blackboard in this course to distribute course announcements and grades.

Course software.This course has an associated software package called introcs that enables students to write and test code. Install it on your computer by following the instructions for your operating system: either Windows, Mac, or Linux.

Novice precepts. As of Spring 2015, COS 126 is offering two kinds of precepts: those intended for absolute beginners ("novice precepts") and those intended for beginners with some degree of comfort with computational/logical thinking ("regular precepts"). This entire course is designed to be approachable for students with no computing background, but we have found that absolute beginners prefer to have more time to cover the same topics and exercises in precept, so you may choose to register for either 80 minute or 50 minute precepts. If you want to switch from a regular precept to a novice precept, or vice versa, please contact the lead preceptors.

Cluster computers.For students who may not have a computer or for students whose computers fail during the semester, we provide cluster machines in Friend Center 017. Click here for information on using the labs.


COS 126 is taught by a mix of research faculty, teaching faculty, and graduate students. Below you will find our contact information, but please keep in mind that it is almost always more appropriate to post your question on Piazza rather than emailing an individual staff member. Our office hours and precept schedule can be found on the "Help!" page.

Douglas Clark

Donna Gabai
Co-Lead Preceptor

Maia Ginsburg
Co-Lead Preceptor

Dan Leyzberg
Co-Lead Preceptor

Alan Kaplan

Jonathan Frankle
Graduate Student

Shaoqing (Victor) Yang
Graduate Student

Nevin Li
Graduate Student

Stephen Cook
Graduate Student

Jennifer Gossels
Graduate Student

Ben Jones
Graduate Student

Steven Goldfeder
Graduate Student

Sarthak Grover
Graduate Student

Evan Petersen
Graduate Student

Firdevs Ulus
Graduate Student

Shuran Song
Graduate Student

Sukret Hasdemir
Graduate Student

Cagin Ararat
Graduate Student


Grade weighting. Semester grades in COS 126 are composed of two two-part exams, worth a combined 50% of the grade, nine weekly programming assignments worth 40%, one final programming project worth the remaining 10, and staff discretion.

Curve. We typically do not curve grades in this class. You should expect that the cutoff for an "A" will be approximately 93% of the available points, for an "A-" you'll need approximately 90% and so on.

Midterm exams. There are two two-part exams during the semester. One set will be given in middle of the semester, and one set in the last week or so of classes. The exams have a written portion, worth 70% of the exam grade, and a programming portion, worth the remaining 30. There will be no final exam. No makeup exams will be considered without a Dean's recommendation and our preapproval.

Programming assignments. There are nine weekly programming assignments all equally weighted.

Final project. The final project is a large programming assignment, approximately the length of two weekly assignments. It is due at the end of Reading Period.

Late submissions. The weekly assignments in this course are due on Monday nights at midnight. Submissions made at 12:01am will be marked late. If any part of an assignment is submitted late, the entire assignment will be marked late. Students have four free late days to use as they wish throughout the semester. To use a late day, students do not need to notify their preceptors but they do need to remove their work from Dropbox, our online submission system. Work left on Dropbox will be graded as-is. Students who submit late work after they have used all four free late days will lose 20% of the possible points on the late assignment per day or partial day late thereafter. Outside of this policy, the only late work that will be excused is in the case of medical or personal emergency as indicated by a letter from a Dean, Director of Studies, or from McCosh Health Center. We will not accept any work for this semester after Dean's Date. You cannot use any late days on the final project.

Extra credit. Some of the assignments in this course feature optional extra credit sections intended for students who have completed every other part of the assignment first. In COS 126, extra credit points are only given a small discretionary value at the end of the term. Rather than adding the extra credit points to the total number of earned points in the semester, the course staff considers extra credit for students who end the semester close to a grade boundary, potentially pushing an "A-" to an "A" for example. Note that extra credit sections have stricter collaboration and late policies than the rest of the assignment: Extra credit may not be submitted late under any circumstances. Extra credit may not be discussed, even conceptually, with anyone except your partner and the course staff. Course staff are only permitted to clarify the wording of the extra credit, as we would on an exam question. Staff should not give hints or tips on extra credit nor help debug a student's extra credit code. Students working on a partnered assignment may choose to do the extra credit individually or together. You should decide this before you begin the extra credit.

Regrades. If you feel we have made a mistake while grading your work, please write a short note describing the potential mistake and attach it to the graded work. Return it to your preceptor within two weeks of the work being handed back.

Auditing COS 126. Auditors must identify themselves to the lead preceptors via email as soon as possible. Auditors will receive only automated feedback on work (i.e., immediate feedback in the submission system, as well as an e-mailed copy of the testing performed on their submissions). To earn audit credit, you must successfully complete all of the programming assignments and the final project (i.e., pass all Dropbox test cases), using at most four late days. Auditors do not take the exams in this course.


Our plea. COS 126 is a challenging course that requires a significant time commitment for most students. If you fall behind, please (please!) ask for help! The course staff will be happy to go through any part of the material with you and help you work on your assignments or study for our exams. It takes us more than twenty hours to investigate and prepare each plagiarism case that we bring to the Committee on Discipline. We would much rather spend that time helping you learn the material.

Prosecution. We actively police every submission made to us for every assignment and exam. We have archives of every imaginable source of solutions to our assignments including many years of Princeton students' past submissions. We compare these results both by automated systems that check for similarities in code structure and by hand. We take no pleasure in bringing cases to the Committee on Discipline, but we will continue to do so if students continue to plagiarize. Part of our job is to keep the playing field level for the vast majority of students who work very hard in this course. For an account of a recent cluster of plagiarism cases in COS 126, see this article in The Daily Prince from Spring 2014.

Ground rules. In this course you may only receive help from people in the ways described below. You must acknowledge all the help you receive in the readme.txt file you submit for each assignment. You are not allowed to post questions about the course or about any of our assignments on any website other than our Piazza page. If you have any question whatsoever about what is allowed, please ask us!

COS 126

Your work. When we talk about work, this includes code, comments, readme files, or anything else you create for this course.

The rules above apply both to finished and unfinished work. They continue to apply even after this semester is over.

In some assignments, you are given some code to begin with. Like other course materials, you are allowed to read and discuss the original code with other students, to figure out what it does and how it works. But once you make a change to the code, it becomes your work and the rules above apply to it.

Citing allowable references. Copying or adapting work that is not yours is only permitted if it comes from the course materials. If you do so, you must cite what you used.

Reading someone else's solutions (or partial solutions) for assignments (or anything similar to any COS 126 assignment) is not allowed.

Peer Discussion

You must individually compose your solutions for the course, but some common concerns may be discussed with other current students, or publicly on Piazza. Because of the rules above, these discussions must be kept at a general level, without sharing code or other work about assignments. For example, you may ask about:

Don't let someone be too helpful: it is not allowed for someone to lead you step-by-step through any part of an assignment.

Help From COS 126 Graduates

Anyone who successfully completed COS 126 in a previous term is allowed to assist you in the following ways, similar to what a lab TA would do:

Anybody else (e.g., friends, family, tutors) may help you under these same conditions (provided they are not taking COS 126 now and never will in the future).

Pair Programming

On certain assignments the collaboration policy is relaxed to allow working with a partner.

If two students begin working on an assignment as partners and cannot complete it together, at least one student must contact the lead preceptor to request a partnership dissolution.

Taking COS 126 again.

If you took COS 126 (or part of it) before, you may look at your old work but you may not look at the feedback we gave you on your old work. What's more, you may not look at your old work on assignments where: you previously partnered; or you are partnering this time; or you were previously found responsible for plagiarism by the Committee on Discipline. 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.


If anything about these policies is unclear during the course, please consult us and ask for clarification. Princeton's Rights, Rules, Responsibilities handbook asserts:

The only adequate defense for a student accused of an academic violation is that the work in question does not, in fact, constitute a violation. Neither the defense that the student was ignorant of the regulations concerning academic violations nor the defense that the student was under pressure at the time the violation was committed is considered an adequate defense.

We use software to compare student submissions. Pairs that are identified as similar are inspected manually by course staff.

Violators of the course policy will be referred to the Committee on Discipline for review. If found responsible, you will receive an F as a course grade plus whatever disciplinary action the Committee imposes. The typical penalty they impose for plagiarism is suspension from the University for one year.