This is CS50 - cdn.cs50.net
Transcript of This is CS50 - cdn.cs50.net
This is CS50
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
2/3of CS50 students have never taken CS before
input → → output
000
001
010
011
100
101
110
111
123
1231
12310 1
123100 10 1
123100 10 1
100 × 1
123100 10 1
100 × 1 10 × 2+
123100 10 1
100 × 1 10 × 2 1 × 3+ +
123100 10 1
100 20 3+ +
123
# # #100 10 1
# # #102 101 100
# # #22 21 20
# # #4 2 1
0004 2 1
0014 2 1
0104 2 1
0114 2 1
1004 2 1
1014 2 1
1104 2 1
1114 2 1
A
65
01000001
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
H I !
72 73 33
H I !
01001000 01001001 00100001
Unicode
4,036,991,159
11110000 10011111 10011000 10110111
RGB
72 73 33
72 73 33
144 60 64 128 60 64144 62 64 128 62 64144 65 64 128 65 64144 62 64 128 62 64144 69 64 128 69 64144 69 64 128 69 64144 67 64 128 67 64
input → → output
algorithm
n
n/2n
n/2n
n/2n
n/2n
log2 n
pseudocode
1 Pick up phone book2 Open to middle of phone book3 Look at page4 If person is on page5 Call person6 Else if person is earlier in book7 Open to middle of left half of book8 Go back to line 39 Else if person is later in book10 Open to middle of right half of book11 Go back to line 312 Else13 Quit
1 Pick up phone book2 Open to middle of phone book3 Look at page4 If person is on page5 Call person6 Else if person is earlier in book7 Open to middle of left half of book8 Go back to line 39 Else if person is later in book10 Open to middle of right half of book11 Go back to line 312 Else13 Quit
1 Pick up phone book2 Open to middle of phone book3 Look at page4 If person is on page5 Call person6 Else if person is earlier in book7 Open to middle of left half of book8 Go back to line 39 Else if person is later in book10 Open to middle of right half of book11 Go back to line 312 Else13 Quit
1 Pick up phone book2 Open to middle of phone book3 Look at page4 If person is on page5 Call person6 Else if person is earlier in book7 Open to middle of left half of book8 Go back to line 39 Else if person is later in book10 Open to middle of right half of book11 Go back to line 312 Else13 Quit
1 Pick up phone book2 Open to middle of phone book3 Look at page4 If person is on page5 Call person6 Else if person is earlier in book7 Open to middle of left half of book8 Go back to line 39 Else if person is later in book10 Open to middle of right half of book11 Go back to line 312 Else13 Quit
● functions○ arguments, return values
● conditionals● Boolean expressions● loops● variables● ...
#include <stdio.h>
int main(void){ printf("hello, world\n");}
print("hello, world")
input → → outputalgorithm
→ → algorithm → output
→ → → output
→ →
input → → outputalgorithm
→ → → outputalgorithm
→ → → output
→ →
input → → outputalgorithm
→ → → outputalgorithm
→ → → output
→ →
→
→
→ →
→ → →
This is CS50