Week 0

Scratch

Welcome!

mindset

🌟 Welcome to CS50!

This class is about more than computer programming!

The practical skills you will learn may impact your life well beyond computer science.

This class is about problem-solving in a way that is exceedingly empowering!

journey

Your Learning Journey

Aspect What to Expect
Challenge "Drinking from the firehose" of knowledge
Growth Advance "you" from "where you are today"
Accomplishment Amazed at what you'll accomplish in weeks

The standard: Your personal growth matters more than any imagined benchmark!

system

You're Not Alone!

First CS class? Don't be scared! Most peers are beginners too!

Support Network:
- Teaching Fellows
- Course Assistants
- Peer Community
- All here to help you!

Key Advice: Give yourself the time you need to learn. Everyone learns differently. If something doesn't work at first, you will grow with time!

empowerment

Problem-Solving Empowerment

You will likely take the problem solving that you learn here, which will likely be instantly applicable to your work beyond this course and even your career as a whole!

This course focuses on advancing you from where you are today rather than hitting some imagined standard.

growth

Growth Mindset

The most important opening consideration: Give the time you need to learn through this course.

Everyone learns differently. If something does not work out well at the start, know that with time you will grow and grow in your skill.

Progress over perfection is the goal!

Community!

global

🌍 Join Our Community

You are part of:
- Harvard College
- Harvard Extension School
- edX.org worldwide learners

Virtual & In-Person Events:
- CS50 Puzzle Day
- CS50 Fair

campus life

Harvard Campus Life

Available to on-campus students:
- CS50 Lunches
- CS50 Hackathon

Community Support:
- Collaborative learning environment
- Peer support networks
- Teaching staff guidance

together

We're In This Together

Remember: Most students are experiencing their first computer science class - just like you!

Support System:
βœ… Teaching Fellows
βœ… Course Assistants
βœ… Peer Community
βœ… All here to help you succeed!

You're not alone in this learning journey!

support network

Learning Support Network

Don't be scared if this is your first computer science class! For most of your peers, this is their first computer science class, too!

Available Help:
- Teaching fellows
- Course assistants
- Your peer community

All are here to help you throughout the course!

events

πŸŽ‰ CS50 Events

Join us (whether in person or virtually) at:

CS50 Puzzle Day - Collaborative problem solving
CS50 Fair - Showcase your projects

On-campus students can also attend CS50 Lunches and CS50 Hackathon for additional community building and learning opportunities.

Computer Science and Problem Solving

core concept

The Essence of CS

Computer programming = Problem solving

counting systems

From Unary to Binary

Unary (Base-1):
- Counting one finger at a time
- Simple attendance tracking

Binary (Base-2):
- Computers use this!
- Bits: 0 or 1 (off/on)
- Millions of transistors = on/off switches

binary visual

πŸ’‘ Binary with 3 Light Bulbs

4 2 1 Decimal
0 0 0 0
0 0 1 1
0 1 0 2
0 1 1 3
1 0 0 4
1 1 1 7

Binary Places: 2² 2¹ 2⁰ = 4 2 1

Inside devices: Millions of "light bulbs" (transistors)!

black box

Input β†’ [ Black Box ] β†’ Output
What happens inside the "black box" is our focus!

ASCII

text mapping

ASCII: Letters β†’ Numbers

Just as numbers are binary patterns of ones and zeros, letters are represented using ones and zeros, too!

Since there is an overlap between the ones and zeros that represent numbers and letters, the ASCII standard was created to map specific letters to specific numbers.

For example, the letter A was decided to map to the number 65. 01000001 represents the number 65 in binary.

example

How Messages Work

Text Message: "HI!"
Binary Numbers: 72, 73, 33
ASCII Mapping: H=72, I=73, !=33

Visualization for 65 (A):

128: 0 / 64: 1 / 32: 0 / 16: 0 / 8: 0 / 4: 0 / 2: 0 / 1: 1

benefits

The Power of Standards

ASCII enables:
- Universal character mapping
- Consistent text representation
- Reliable communication between systems

Without ASCII: Every computer might use different number-to-letter mappings!

Standards allow computers worldwide to agree on character representations.

Unicode

beyond ascii

Unicode: Global Text

Why needed? ASCII limited to 255 characters

Unicode expands:
- International characters: δΈ­ζ–‡, EspaΓ±ol, FranΓ§ais
- Special symbols
- Emoji! πŸŽ‰

Supports thousands of characters beyond ASCII limits.

emoji world

The Emoji Revolution

Examples:
πŸ˜€ πŸ˜ƒ πŸ˜„ 😁 πŸ˜† πŸ˜… πŸ˜‚ πŸ™‚ πŸ™ƒ πŸ˜‰ 😊 πŸ˜‡ 😍
😘 πŸ˜— πŸ˜™ 😚 πŸ˜‹ πŸ˜› 😜 😝 πŸ€‘ πŸ€“ 😎 πŸ€— 😏

Note: Display varies by device manufacturer

Unicode includes emoji that you probably use every day!

features

Unicode Technical Features

Key Aspects:
- Expanded character set beyond ASCII
- Supports thousands of characters
- Includes special characters and emoji
- Standardized binary patterns

Display Note: Each device manufacturer may display emoji slightly differently

More features are continually added to represent new characters and emoji!

RGB

color system

🎨 RGB Color Representation

RGB = Red, Green, Blue

Zeros and ones can be used to represent color!

Each color: 0-255 value (one byte)
Three bytes combine to create colors

Example: 72, 73, 33 as RGB = light yellow shade

rgb basics

How Images Work

Each pixel requires three bytes:
- Red value (0-255)
- Green value (0-255)
- Blue value (0-255)

Combination creates the color you see

Digital images = Grid of RGB values
Videos = Many images stored together
Music = Bytes representing sound patterns

Algorithms

What are Algorithms?

Definition: Step-by-step instructions to solve a problem

Example: Finding a name in a phone book

Different approaches = Different algorithms

Each has different efficiency characteristics!

search comparison 1

Algorithm 1: Linear Search
- Read page 1, then 2, then 3...
- Big-O: O(n)

search comparison 2

Algorithm 2: Two Pages at Once
- Search two pages simultaneously
- Big-O: O(n/2)

search comparison 3

Algorithm 3: Binary Search
- Start middle, eliminate half each time
- Big-O: O(logβ‚‚n)

efficiency

Algorithm Efficiency

Big-O Notation measures how algorithm speed scales with input size

Algorithm Speed Efficiency
Linear O(n) Slowest
Two Pages O(n/2) 2x Faster
Binary O(logβ‚‚n) Most Efficient

Key Insight: Doubling problem size barely affects binary search time!

CLICK HERE!

check it out

But how's it built?

building

thank you

Subscribe

I think that's a pretty good idea