CS50 Week 0: Thinking Before Coding
My notes from CS50 Week 0: why foundations still matter in the age of AI, how computers represent information, and what makes an algorithm good.
You're still in the driver's seat: the conductor, the pilot.
These are my notes from Week 0 of CS50x, Harvard's introduction to computer science, taken by hand and typed up here. I stopped before the Scratch section; the ideas below are what stuck with me.
Why foundations still matter¶
Over the past few years, AI has been seen as a game changer for programming. That's true, and it will stay true. You can ask the computer to find bugs, spot mistakes or add a feature, and it does.
We humans have long been the bottleneck in this industry. There are only so many of us, and there are always more bugs to fix and more features to build.
So why learn the basics at all? Because introductory courses like CS50 or SICP were never really about programming. Programming is a byproduct. The real goal is learning how to think: how to take an input, turn it into the correct output, and master the tools along the way.
By the end, you don't just know a few languages. You can teach yourself new things and tell the computer, more and more precisely, what you want. With AI or without it, you're still the one who knows what you're talking about and what can actually be solved. Master the ideas, then lean on a copilot to help you solve the problems.
Computer science is problem solving¶
Computer science is the study of information: how to represent it and how to process it. Computational thinking is taking those ideas and applying them to real problems.
Every problem has the same shape:
input (the problem) → [ black box: the algorithm ] → correct output (the result)
The rest of the course is about what goes inside that box.
Everything is zeros and ones¶
Computers only have two symbols: 0 and 1. That's binary, base 2. A single binary digit is a bit: 0 is a switch off, 1 is a switch on. A computer is millions of tiny switches, transistors, each holding a bit.
Binary works like decimal, just with powers of 2 instead of 10:
123 (decimal) = 1×10² + 2×10¹ + 3×10⁰
4 2 1
0 1 1 = 2 + 1 = 3
1 0 0 = 4
To count to 8 you need a fourth bit. Run out of bits and the counter wraps back to zero, so more numbers literally means more hardware.
Eight bits make a byte, which counts from 00000000 (0) to 11111111 (255): 256 possible values.
Text¶
Letters are just numbers everyone agreed on. In ASCII, A is 65, B is 66, and so on. So 72 73 33 spells HI!
The detail I liked: lowercase letters sit exactly 32 above uppercase (A = 65, a = 97). In binary, going from H to h flips a single bit:
H 01001000
h 01101000
ASCII only covers 256 characters. Unicode uses up to 32 bits, enough for every human language and every emoji, like 😂. Still just zeros and ones in the end.
Colors, video and sound¶
- Color: RGB stores an amount of red, green and blue, 0–255 each, so 3 bytes per pixel.
- Video: images shown fast enough to trick our minds into seeing motion.
- Music: each note can be described by three numbers: frequency, duration and loudness.
The pattern behind all of it: you only have 0 and 1, so you agree on a way to arrange them.
Algorithms: good, better, best¶
An algorithm is a set of step-by-step instructions for solving a problem, like finding a name in a sorted contact list.
Several algorithms can solve the same problem, but they're not equal. Some are faster or use less memory, and some are simply better designed. As David Malan put it, it's not just about getting the job done but solving the problem better, with whatever resource is limited: time, memory, people or money.
- Good design: logic that is correct and efficient.
- Code: an algorithm written in a language the computer understands.
- Pseudocode: the same steps in plain English. There's no official format; everyone writes it their own way.
Even instructions are standardized. Chip makers like Intel, AMD and NVIDIA decide which bit patterns mean "add these numbers" or "load this into memory".
My takeaway¶
Week 0 has almost no code, and that's the point: before writing anything, you need to know what information you're working with and what steps will transform it. The languages come next.
Based on CS50x by David J. Malan, Harvard University, licensed under CC BY-NC-SA 4.0. These notes are my own summary.