Lecture0 PDF
Lecture0 PDF
2/3
of CS50 students have never taken CS before
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
input → → output
representation
0123456789
01
123
1
123
10 1
123
100 10 1
123
100 10 1
123
100 × 1
100 10 1
123
100 × 1 +
100 10 1
123
100 × 1 + 10 × 2
100 10 1
123
100 × 1 + 10 × 2 +
100 10 1
123
100 × 1 + 10 × 2 + 1×3
100 10 1
123
100 + 20 + 3
123
100 10 1
000
100 10 1
001
100 10 1
002
100 10 1
003
100 10 1
004
100 10 1
005
100 10 1
006
100 10 1
007
100 10 1
008
100 10 1
009
100 10 1
010
100 10 1
000
102 101 100
000
22 21 20
000
4 2 1
000
4 2 1
001
4 2 1
010
4 2 1
011
4 2 1
100
4 2 1
101
4 2 1
110
4 2 1
111
bit
💡
bit bit bit bit bit bit bit bit
💡💡💡💡💡💡💡
💡
byte
💡💡💡💡💡💡💡
💡
A
65
01000001
65
ASCII
... A B C D E F G H I ...
... 65 66 67 68 69 70 71 72 73 ...
72 73 33
H I
72 73 33
H I !
72 73 33
Unicode
128514
11111011000000010
RGB
72 73 33
72 73 33
input → → output
algorithms
1024
512
256
128
64
32
16
8
4
2
1
pseudocode
1 Pick up phone book
2 Open to middle of phone book
3 Look at page
4 If Smith is on page
5 Call Mike
6 Else if Smith is earlier in book
7 Open to middle of left half of book
8 Go back to line 3
9 Else if Smith is later in book
10 Open to middle of right half of book
11 Go back to line 3
12 Else
13 Quit
1 Pick up phone book
2 Open to middle of phone book
3 Look at page
4 If Smith is on page
5 Call Mike
6 Else if Smith is earlier in book
7 Open to middle of left half of book
8 Go back to line 3
9 Else if Smith is later in book
10 Open to middle of right half of book
11 Go back to line 3
12 Else
13 Quit
1 Pick up phone book
2 Open to middle of phone book
3 Look at page
4 If Smith is on page
5 Call Mike
6 Else if Smith is earlier in book
7 Open to middle of left half of book
8 Go back to line 3
9 Else if Smith is later in book
10 Open to middle of right half of book
11 Go back to line 3
12 Else
13 Quit
1 Pick up phone book
2 Open to middle of phone book
3 Look at page
4 If Smith is on page
5 Call Mike
6 Else if Smith is earlier in book
7 Open to middle of left half of book
8 Go back to line 3
9 Else if Smith is later in book
10 Open to middle of right half of book
11 Go back to line 3
12 Else
13 Quit
1 Pick up phone book
2 Open to middle of phone book
3 Look at page
4 If Smith is on page
5 Call Mike
6 Else if Smith is earlier in book
7 Open to middle of left half of book
8 Go back to line 3
9 Else if Smith is later in book
10 Open to middle of right half of book
11 Go back to line 3
12 Else
13 Quit
● functions
● conditions
● Boolean expressions
● loops
● functions
● conditions
● Boolean expressions
● loops
● variables
● threads
● events
● ...
#include <stdio.h>
int main(void)
{
printf("hello, world\n");
}
input → algorithms → output
→ algorithms → output
→ → output
→ →
input → algorithms → output
→ algorithms → output
→ → output
→ →
input → algorithms → output
→ algorithms → output
→ → output
→ →
→
→
→ →
→ → →
This is CS50