David J. Malan ’99


This is CS50, Harvard University’s introduction to the intellectual enterprises of computer science and the art of programming, for concentrators and non-concentrators alike, with or without prior programming experience. (Two thirds of CS50 students have never taken CS before.) This course teaches you how to solve problems, both with and without code, with an emphasis on correctness, design, and style. Topics include computational thinking, abstraction, algorithms, data structures, and computer science more generally. Problem sets inspired by the arts, humanities, social sciences, and sciences. More than teach you how to program in one language, this course teaches you how to program fundamentally and how to teach yourself new languages ultimately. The course starts with a traditional but omnipresent language called C that underlies today’s newer languages, via which you’ll learn not only about functions, variables, conditionals, loops, and more, but also about how computers themselves work underneath the hood, memory and all. The course then transitions to Python, a higher-level language that you’ll understand all the more because of C. Toward term’s end, the course introduces SQL, via which you can store data in databases, along with HTML, CSS, and JavaScript, via which you can create web and mobile apps alike. Course culminates in a final project, optional hackathon, and campus-wide CS50 Fair. See for advice, FAQs, syllabus, and what’s new. Email the course’s heads at with questions.

Course Notes

This course ordinarily meets for lectures in Sanders Theatre on Mondays, 1:30pm–4:15pm, but the course’s first lecture will be in Sanders Theatre on Wednesday, September 6, 1:30pm–4:15pm. Students are expected to attend the course’s lectures in person unless simultaneously enrolled in another course that meets at the same or an overlapping time, in which case they may watch CS50’s lectures online and attend the other course in person. (The Ad Board has already granted this exception for CS50; no other steps are required.) If you have other academic or athletic conflicts, submit Course also includes a weekly discussion, to be arranged. CS50 is ordinarily graded SAT/UNS, though students whose concentration requires letter grades should change their grading status to letter-graded by the term’s fifth Monday. Students may take CS50 SAT/UNS to fulfill the Science and Engineering and Applied Science distribution requirement or the Quantitative Reasoning with Data requirement, but not both. First years may take both CS50 and a freshman seminar SAT/UNS. Graduate students are welcome to enroll in or cross-register for CS50. All students are expected to attend an orientation meeting during the second week of term; students with conflicts may watch online.


You are expected to

  • attend (or, if simultaneously enrolled in another course, watch) all lectures,
  • attend ten sections,
  • solve ten problem sets,
  • submit ten checks for understanding, and
  • design and implement a final project.

Learning Objectives

Among this course’s objectives are that you learn how to:

  • think more methodically;
  • program procedurally;
  • represent and process information;
  • communicate succinctly and precisely;
  • solve problems efficiently;
  • recognize patterns among problems;
  • decompose problems into parts and compose solutions thereto;
  • operate at multiple levels of abstraction;
  • separate design from implementation details;
  • infer from first principles how systems work;
  • assess the correctness, design, and style of code;
  • teach yourself new languages;
  • identify threats to privacy and security;
  • read documentation, drawing conclusions from specifications;
  • test solutions to problems, find faults, and identify corner cases;
  • describe symptoms of problems precisely and ask questions clearly; and
  • identify and quantify trade-offs among resources, particularly time and space.

Ultimately, the course aspires to provide you with a foundation for further studies in computer science and to empower you to apply computer science to problems in other domains.


Outlined below is the course’s subject matter, organized by week, each subtitled per to the context in which its topics are introduced.

Week 0 Scratch

Computer Science. Computational Thinking. Problem Solving: Inputs, Outputs. Representation: Unary, Binary, Decimal, ASCII, Unicode, RGB. Abstraction. Algorithms. Running Times. Pseudocode. Scratch: Functions, Arguments, Return Values; Variables; Boolean Expressions, Conditionals; Loops; Events; Threads.

Week 1 C

C. Source Code. Machine Code. Compiler. Correctness, Design, Style. Visual Studio Code. Syntax Highlighting. Escape Sequences. Header Files. Libraries. Manual Pages. Types. Conditionals. Variables. Loops. Linux. Graphical User Interface (GUI). Command-Line Interface (CLI). Constants. Comments. Pseudocode. Operators. Integer Overflow. Floating-Point Imprecision.

Week 2 Arrays

Preprocessing. Compiling. Assembling. Linking. Debugging. Arrays. Strings. Command-Line Arguments. Cryptography.

Week 3 Algorithms

Searching: Linear Search, Binary Search. Sorting: Bubble Sort, Selection Sort, Merge Sort. Asymptotic Notation: \(O\), \(\Omega\), \(\Theta\). Recursion.

Week 4 Memory

Pointers. Segmentation Faults. Dynamic Memory Allocation. Stack. Heap. Buffer Overflow. File I/O. Images.

Week 5 Data Structures

Abstract Data Types. Queues, Stacks. Linked Lists. Trees, Binary Search Trees. Hash Tables. Tries.

Week 6 Python

Python: Functions, Arguments, Return Values; Variables; Boolean Expressions, Conditionals; Loops. Modules, Packages.

Week 7 SQL

SQL: Tables; Types; Statements; Constraints; Indexes; Keywords, Functions; Transactions. Race Conditions. SQL Injection Attacks.

Week 8 🎃 HTML, CSS, JavaScript

Internet: Routers; TCP/IP; DNS. HTTP: URLs, GET, POST. HTML: Tags; Attributes. Servers. Regular Expressions. CSS: Properties; Selectors. Frameworks. JavaScript: Variables; Conditionals; Loops. Events.

Week 9 Flask

Flask. Route. Decorators. Requests, Responses. Sessions. Cookies.

Week 10 Cybersecurity

Passwords. Brute-Force Attacks. Password Managers. Two-Factor Authentication. One-Time Passwords. Hashing. Rainbow Table. Salting. Cryptography. Secret-Key Cryptography. Symmetric Cryptography. Asymmentric Cryptography. Public-Key Cryptography. HTTPS. Passkeys. End-to-End Encryption. Deletion. Secure Deletion. Full-Disk Encryption. Ransomware.


CS50 is ordinarily graded Satisfactory/Unsatisfactory (SAT/UNS), much like freshman seminars and some tutorials, though students whose (potential) concentration requires letter grades should change their grading status to letter-graded via my.harvard by the term’s fifth Monday. Even though first years may not ordinarily enroll in both a Freshman Seminar and another non-letter-graded course in any one term, they may take both CS50 and a Freshman Seminar SAT/UNS.

Whether taking the course SAT/UNS or for a letter grade, you must still meet all expectations in order to be eligible for a satisfactory grade unless granted an exception in writing by the course’s heads.

Final grades are determined using the following weights:

Problem Sets 60%
Checks for Understanding 10%
Final Project 15%
Attendance* 15%

* At lectures (unless simultaneously enrolled) and sections.

Problem sets and the final project are evaluated along axes of correctness, design, and style, with scores ordinarily computed as 2 × correctness + 2 × design + 1 × style. Scores are normalized across teaching fellows and comfort levels at term’s end, so mid-semester comparisons among students of scores are not reliable indicators of standing.

Know that CS50 draws quite the spectrum of students, including “those less comfortable,” “those more comfortable,” and those somewhere in between. However, what ultimately matters in this course is not so much where you end up relative to your classmates but where you end up relative to yourself when you began.

Each student’s final grade is individually determined at term’s end. Remarkable effort and upward trending are considered, as is input from the teaching fellows. The course does not have pre-determined cutoffs for final grades. The course is not graded on a curve. Those less comfortable and somewhere in between are not at a disadvantage vis-à-vis those more comfortable.


No books are required or recommended for this course.


Week Lecture Date
Week 0 Scratch 2023-09-06T13:30:00-04:00/2023-09-06T16:15:00-04:00
Week 1 C 2023-09-11T13:30:00-04:00/2023-09-11T16:15:00-04:00
Week 2 Arrays 2023-09-18T13:30:00-04:00/2023-09-18T16:15:00-04:00
Week 3 Algorithms 2023-09-25T13:30:00-04:00/2023-09-25T16:15:00-04:00
Week 4 Memory 2023-10-02T13:30:00-04:00/2023-10-02T16:15:00-04:00
Week 5 Data Structures 2023-10-11T13:30:00-04:00/2023-10-11T16:15:00-04:00
Week 6 Python 2023-10-23T13:30:00-04:00/2023-10-23T16:15:00-04:00
  Artificial Intelligence 2023-10-27T12:00:00-04:00/2023-10-27T13:00:00-04:00
Week 7 SQL 2023-10-30T13:30:00-04:00/2023-10-30T16:15:00-04:00
Week 8 HTML, CSS, JavaScript 2023-11-06T13:30:00-05:00/2023-11-06T16:15:00-05:00
Week 9 Flask 2023-11-13T13:30:00-05:00/2023-11-13T16:15:00-05:00
  Cybersecurity 2023-11-20T13:30:00-05:00/2023-11-20T16:15:00-05:00


Lectures are supplemented by weekly, 2-hour sections led by the course’s teaching fellows. Different sections are offered for those less comfortable, those more comfortable, and those somewhere in between. This fall, too, there will be a fourth track for those “least comfortable,” who might not feel ready for studies in STEM, let alone programming, but who are still eager (if nervous!) to dive in too.

Attendance at sections is expected.

Office Hours

Sections are supplemented by office hours, opportunities for help with problem sets in a small group by appointment. At the end of most weeks the course also holds open office hours, for help with problem sets alongside all of the course’s teaching fellows and course assistants.

Attendance at office hours is optional.

Problem Sets

Problem sets are programming assignments that allow you to implement each week’s concepts in code.

Problem Set Language Release Deadline
Problem Set 0 Scratch 2023-09-06T16:15:00-04:00 2023-09-10T23:59:00-04:00
Problem Set 1 C 2023-09-11T16:15:00-04:00 2023-09-17T23:59:00-04:00
Problem Set 2 C 2023-09-18T16:15:00-04:00 2023-09-24T23:59:00-04:00
Problem Set 3 C 2023-09-25T16:15:00-04:00 2023-10-01T23:59:00-04:00
Problem Set 4 C 2023-10-02T16:15:00-04:00 2023-10-08T23:59:00-04:00
Problem Set 5 C 2023-10-11T16:15:00-04:00 2023-10-17T23:59:00-04:00
Problem Set 6 Python 2023-10-23T16:15:00-04:00 2023-10-29T23:59:00-04:00
Problem Set 7 SQL 2023-10-30T16:15:00-04:00 2023-11-05T23:59:00-05:00
Problem Set 8 HTML, CSS, JavaScript 2023-11-06T16:15:00-05:00 2023-11-12T23:59:00-05:00
Problem Set 9 Python, SQL, HTML, CSS, JavaScript 2023-11-13T16:15:00-05:00 2023-11-19T23:59:00-05:00

Checks for Understanding

Checks for understanding (“checks”) are short assignments due after each lecture that ask you to practice applying each lecture’s concepts. Among the goals of the checks for understanding are that you synthesize knowledge from class alone. You may use any materials on CS50’s course website (i.e.,, but nothing else (i.e., you may not use tools like or, nor search for information on the internet at large). The only humans to whom you may turn for help or from whom you may receive help are the course’s heads.

Check Release Deadline
Check 0 2023-09-06T16:15:00-04:00 2023-09-10T23:59:00-04:00
Check 1 2023-09-11T16:15:00-04:00 2023-09-17T23:59:00-04:00
Check 2 2023-09-18T16:15:00-04:00 2023-09-24T23:59:00-04:00
Check 3 2023-09-25T16:15:00-04:00 2023-10-01T23:59:00-04:00
Check 4 2023-10-02T16:15:00-04:00 2023-10-08T23:59:00-04:00
Check 5 2023-10-11T16:15:00-04:00 2023-10-17T23:59:00-04:00
Check 6 2023-10-23T16:15:00-04:00 2023-10-29T23:59:00-04:00
Check 7 2023-10-30T16:15:00-04:00 2023-11-05T23:59:00-05:00
Check 8 2023-11-06T16:15:00-05:00 2023-11-12T23:59:00-05:00
Check 9 2023-11-13T16:15:00-05:00 2023-11-19T23:59:00-05:00

CS50 Hackathon

Start End
2023-12-01T19:00:00-05:00 2023-12-02T07:00:00-05:00

The CS50 Hackathon is an epic all-nighter at Harvard during which you can dive into your final project’s implementation alongside classmates (from Yale and Harvard alike!) and staff. If you choose to partake, you’ll be asked to propose three milestones for yourself that evening: a “good” one that you intend to achieve no matter what; a “better” one that you think you can achieve; and a “best” one that you hope to achieve.

Dinner will be served around 9pm, second dinner will be served around 1am, and those still awake around 5am will be treated to breakfast at IHOP.

Final Project

The climax of this course is its final project. The final project is your opportunity to take your newfound savvy with programming out for a spin and develop your very own piece of software. So long as your project draws upon this course’s lessons, the nature of your project is entirely up to you, albeit subject to the staff’s approval. You may implement your project in any language(s) as long as the staff approves. You are welcome to utilize any infrastructure, provided the staff ultimately has access to any hardware and software that your project requires. All that we ask is that you build something of interest to you, that you solve an actual problem, that you impact campus, or that you change the world. Strive to create something that outlives this course.

Inasmuch as software development is rarely a one-person effort, you are allowed an opportunity to collaborate with one or two classmates for this final project. Needless to say, it is expected that every student in any such group contribute equally to the design and implementation of that group’s project. Moreover, it is expected that the scope of a two- or three-person group’s project be, respectively, twice or thrice that of a typical one-person project. A one-person project, mind you, should entail more time and effort than is required by each of the course’s problem sets. Although no more than three students may design and implement a given project, you are welcome to solicit advice from others, so long as you respect the course’s policy on academic honesty.

Milestone Deadline
Proposal 2023-11-19T23:59:00-05:00
Status Report 2023-11-29T23:59:00-05:00
Implementation 2023-12-07T23:59:00-05:00

CS50 Fair

Start End
2023-12-08T13:00:00-05:00 2023-12-08T16:00:00-05:00

The CS50 Fair is an epic display of final projects. Not only is the CS50 Fair a venue at which to see classmates’ projects and demo your own, it is an opportunity to mingle with students, faculty, and staff from across campus.

Attendance is expected of all students.

Also in attendance are popcorn, candy, and a raffle with (fabulous) prizes. Family and friends are welcome to join.


You have a semester-long allowance of 72 hours (divided into 1-minute segments) to turn in problem sets (not checks for understanding) late. This allowance should be used carefully (if at all!), but can otherwise be allocated in any manner of your choosing, which means that you may:

  • Use the full 72 hours on one problem set; or
  • Use just over 7 hours on each problem set; or
  • Use 9 hours and 22 minutes on one problem set, 30 hours and 11 minutes on another, 54 minutes on a third, etc.

The amount of this allowance “charged” to a problem set is equal to the lateness of the latest part of that problem set turned in, for problem sets with multiple parts. Once the 72-hour allowance has been exhausted, then from that point on the course will begin to impose a 0.1% deduction to your grade for all problems in a problem set for each minute it is turned in late. Therefore, once your allowance is exhausted, for example:

  • Any work turned in 10 minutes late will earn 99% of the points it would have earned had it been turned in on time (a 1.0% deduction).
  • Any work turned in 60 minutes late will earn 94% of the points it would have earned had it been turned in on time (a 6.0% deduction).
  • Any work turned in 1,000 minutes (16 hours, 40 minutes) late is effectively zeroed, as that would be a 100.0% deduction.

Furthermore, whether availing yourself of your semester-long allowance (partially or fully) or not, the absolute latest any single problem set or portion thereof may be turned in for credit is 72 hours from its original deadline. Gradescope will not allow any submissions after that point, nor will the course ordinarily accept them via some other means.

Late work will not be accepted on checks for understanding.


Extensions beyond this lateness policy are not ordinarily granted.

Exceptions will only be considered if requested of the course by your resident dean (or if you add the course late). The only individuals authorized to grant extensions are the course’s heads. Please be sure to include any relevant documentation in your request.

Mental Health

If you experience significant stress or worry, changes in mood, or problems eating or sleeping this semester, whether because of CS50 or other courses or factors, please do not hesitate to reach out immediately, at any hour, to any of the course’s heads to discuss. Everyone can benefit from support during challenging times. Not only are we happy to listen and make accommodations with deadlines as needed, we can also refer you to additional support structures on campus, including, but not limited to, the below.

Academic Honesty

The course’s philosophy on academic honesty is best stated as “be reasonable.” The course recognizes that interactions with classmates and others can facilitate mastery of the course’s material. However, there remains a line between enlisting the help of another and submitting the work of another. This policy characterizes both sides of that line.

The essence of all work that you submit to this course must be your own. Collaboration on problem sets is not permitted except to the extent that you may ask classmates and others for help so long as that help does not reduce to another doing your work for you. Generally speaking, when asking for help, you may show your code to others, but you may not view theirs, so long as you and they respect this policy’s other constraints. Collaboration on the course’s checks for understanding is not permitted at all. Collaboration on the course’s final project is permitted to the extent prescribed by its specification.

Regret clause. If you commit some act that is not reasonable but bring it to the attention of the course’s heads within 72 hours, the course may impose local sanctions that may include an unsatisfactory or failing grade for work submitted, but the course will not refer the matter for further disciplinary action except in cases of repeated acts.

Below are rules of thumb that (inexhaustively) characterize acts that the course considers reasonable and not reasonable. If in doubt as to whether some act is reasonable, do not commit it until you solicit and receive approval in writing from the course’s heads. Acts considered not reasonable by the course are handled harshly. If the course refers some matter for disciplinary action and the outcome is punitive, the course reserves the right to impose local sanctions on top of that outcome that may include an unsatisfactory or failing grade for work submitted or for the course itself. The course ordinarily recommends exclusion (i.e., required withdrawal) from the course itself.


  • Communicating with classmates about problem sets’ problems in English (or some other spoken language), and properly citing those discussions.
  • Discussing the course’s material with others in order to understand it better.
  • Helping a classmate identify a bug in their code at office hours, elsewhere, or even online, as by viewing, compiling, or running their code after you have submitted that portion of the pset yourself. Add a citation to your own code of the help you provided and resubmit.
  • Incorporating a few lines of code that you find online or elsewhere into your own code, provided that those lines are not themselves solutions to assigned problems and that you cite the lines’ origins.
  • Reviewing past semesters’ tests and quizzes and solutions thereto that are made available by the course.
  • Sending or showing code that you’ve written to someone, possibly a classmate, so that he or she might help you identify and fix a bug, provided you properly cite the help.
  • Submitting the same or similar work to this course that you have submitted previously to this course, CS50 AP, or CS50x, so long as you disclose as much in your submission, as via comments in your code.
  • Turning to the course’s heads for help or receiving help from the course’s heads with the checks for understanding.
  • Turning to the web or elsewhere for instruction beyond the course’s own, for references, and for solutions to technical difficulties, but not for outright solutions to problem set’s problems or your own final project.
  • Using CS50’s own AI-based software, including the CS50 Duck (ddb) in and as well as in Ed.
  • Whiteboarding solutions to problem sets with others using diagrams or pseudocode but not actual code.
  • Working with (and even paying) a tutor to help you with the course, provided the tutor does not do your work for you.

Not Reasonable

  • Accessing a solution to some problem prior to its deadline.
  • Accessing or attempting to access, without permission, an account not your own.
  • Asking a classmate to see their solution to a problem set’s problem before its deadline.
  • Discovering but failing to disclose to the course’s heads bugs in the course’s software that affect scores.
  • Decompiling, deobfuscating, or disassembling the staff’s solutions to problem sets.
  • Failing to cite (as with comments) the origins of code or techniques that you discover outside of the course’s own lessons and integrate into your own work, even while respecting this policy’s other constraints.
  • Giving or showing to a classmate a solution to a problem set’s problem when it is he or she, and not you, who is struggling to solve it.
  • Looking at another individual’s work on the checks for understanding.
  • Manipulating or attempting to manipulate scores artificially, as by exploiting bugs or formulas in the course’s software.
  • Paying or offering to pay an individual for work that you may submit as (part of) your own.
  • Providing or making available solutions to problem sets to individuals who might take this course in the future.
  • Searching for or soliciting outright solutions to problem sets online or elsewhere.
  • Splitting a problem set’s workload with another individual and combining your work.
  • Submitting (after possibly modifying) the work of another individual beyond the few lines allowed herein.
  • Submitting the same or similar work to this course that you have submitted or will submit to another (non-CS50) course.
  • Submitting work to this course that you intend to use outside of the course (e.g., for a job) without prior approval from the course’s heads.
  • Turning to humans (besides the course’s heads) for help or receiving help from humans (besides the course’s heads) during the checks for understanding or test.
  • Using AI-based software other than CS50’s own (e.g., ChatGPT, GitHub Copilot, Bing Chat, et al.) that suggests or completes answers to questions or lines of code.
  • Viewing another’s solution to a problem set’s problem and basing your own solution on it.

Acknowledgement and Authorization

Harvard plans to record audio, photos, and video of Computer Science 50 (CS50) lectures, sections, office hours, seminars, and other events and activities related to CS50 (the “Recordings”), with the aims of making the content of the course more widely available and contributing to public understanding of innovative learning (the “Projects”). As part of the Projects, the Recordings, or edited versions of them, may be made available to other Harvard students, to students at other educational institutions, and to the broader public via edX, the Internet, television, theatrical distribution, digital media, or other means. One of the ways it is expected that the Recordings, or edited versions of them, will be made publicly available is under a Creative Commons Attribution-NonCommercial-ShareAlike (CC BY-NC-SA) license. Another example is that Harvard may make and disseminate montages of “memories” from the class with images from the Recordings. The Recordings also may be used to make other derivative works in the future. Students may elect not to appear in photos and video used in the Projects and may still participate fully in CS50.

To attend CS50, you will need to sign online an Acknowledgement and Authorization in the following form:

I understand and agree that, if I do not wish any photos or video of me to be used as part of the Projects:

  • If I am participating in CS50 in a classroom or other course location, I should sit in the designated “no-film” zone of the classroom or location, and should not walk in the field of view of the cameras.
  • If I am participating in CS50 online, I should turn off my own camera and should not display a photo of myself. In addition, if I do not wish my real name to be displayed when I speak and my voice is recorded, I should select a pseudonymous user name in Zoom (or other online service). If I select a pseudonymous user name, I will inform the instructor, so the instructor knows who I am.

I understand that I am free not to be included in the Projects’ photos and video in this way, and that this will not affect my grade or my ability to participate in course activities.

Unless I exclude myself from the Projects’ photos and video as described above and take any other steps outlined by the instructor to avoid being filmed, I authorize Harvard and its designees to make and use Recordings of my participation in CS50 and activities related to CS50. I understand and agree that the Recordings may include my image, name, and voice. I also understand and agree that, even if I opt out of the Projects’ photos and video and choose a pseudonymous user name, my voice will be recorded if I am participating online, and may be picked up by microphones outside the “no-film” zone if I am in a CS50 classroom or other location, and my spoken name also may be included in the Recordings. If the class is online, I may participate instead via chat messages, which will not be included in the Recordings.

I understand and agree that Harvard and its designees will have the irrevocable, worldwide right to make, edit, modify, copy, publish, transmit, distribute, sell, publicly display, publicly perform, and otherwise use and make available the Recordings and any other works that may be derived from those Recordings, in any manner or medium now known or later invented, in connection with the Projects, and to authorize others to do so as well. I hereby transfer to Harvard any rights, including copyrights, I may have in the Recordings that Harvard makes. I will remain free to use and disseminate any ideas, remarks, or other material that I may contribute to course discussions.

I acknowledge and agree that I will not be entitled to any payment, now or in the future, in connection with the Recordings or any works derived from them. This Acknowledgment and Authorization is a binding agreement, and is signed as a document under seal governed by the laws of the Commonwealth of Massachusetts.

Unless you exclude yourself as described in the Acknowledgment and Authorization, you are agreeing, by attending CS50, that your participation in CS50 and related activities may be recorded and used by Harvard in connection with the Projects without further obligation or liability to you, even if you do not sign any authorization.

If you have any questions about the above, contact