1 of 114

This is CS50

2 of 114

3 of 114

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

4 of 114

2/3

of CS50 students have never taken CS before

5 of 114

input → 

→ output

6 of 114

000

7 of 114

001

8 of 114

010

9 of 114

011

10 of 114

100

11 of 114

101

12 of 114

110

13 of 114

111

14 of 114

123

15 of 114

123

1

16 of 114

123

10

1

17 of 114

123

100

10

1

18 of 114

123

100

10

1

100 × 1

19 of 114

123

100

10

1

100 × 1

10 × 2

+

20 of 114

123

100

10

1

100 × 1

10 × 2

1 × 3

+

+

21 of 114

123

100

10

1

100

20

3

+

+

22 of 114

123

23 of 114

# # #

100

10

1

24 of 114

# # #

102

101

100

25 of 114

# # #

22

21

20

26 of 114

# # #

4

2

1

27 of 114

000

4

2

1

28 of 114

001

4

2

1

29 of 114

010

4

2

1

30 of 114

011

4

2

1

31 of 114

100

4

2

1

32 of 114

101

4

2

1

33 of 114

110

4

2

1

34 of 114

111

4

2

1

35 of 114

A

36 of 114

65

37 of 114

01000001

38 of 114

ASCII

39 of 114

...

A

B

C

D

E

F

G

H

I

...

...

65

66

67

68

69

70

71

72

73

...

40 of 114

72

73

33

41 of 114

H

I

72

73

33

42 of 114

H

I

!

72

73

33

43 of 114

44 of 114

H

I

!

72

73

33

45 of 114

H

I

!

01001000

01001001

00100001

46 of 114

47 of 114

48 of 114

49 of 114

Unicode

50 of 114

4,036,991,159

51 of 114

11110000 10011111 10011000 10110111

52 of 114

53 of 114

54 of 114

55 of 114

RGB

56 of 114

57 of 114

72

73

33

58 of 114

72

73

33

59 of 114

60 of 114

61 of 114

62 of 114

63 of 114

64 of 114

65 of 114

66 of 114

144 60 64

128 60 64

144 62 64

128 62 64

144 65 64

128 65 64

144 62 64

128 62 64

144 69 64

128 69 64

144 69 64

128 69 64

144 67 64

128 67 64

67 of 114

input → 

→ output

68 of 114

algorithm

69 of 114

70 of 114

71 of 114

72 of 114

73 of 114

n

74 of 114

n/2

n

75 of 114

n/2

n

76 of 114

n/2

n

77 of 114

n/2

n

log2 n

78 of 114

pseudocode

79 of 114

1 Pick up phone book

2 Open to middle of phone book

3 Look at page

4 If person is on page

5 Call person

6 Else if person is earlier in book

7 Open to middle of left half of book

8 Go back to line 3

9 Else if person is later in book

10 Open to middle of right half of book

11 Go back to line 3

12 Else

13 Quit

80 of 114

1 Pick up phone book

2 Open to middle of phone book

3 Look at page

4 If person is on page

5 Call person

6 Else if person is earlier in book

7 Open to middle of left half of book

8 Go back to line 3

9 Else if person is later in book

10 Open to middle of right half of book

11 Go back to line 3

12 Else

13 Quit

81 of 114

1 Pick up phone book

2 Open to middle of phone book

3 Look at page

4 If person is on page

5 Call person

6 Else if person is earlier in book

7 Open to middle of left half of book

8 Go back to line 3

9 Else if person is later in book

10 Open to middle of right half of book

11 Go back to line 3

12 Else

13 Quit

82 of 114

1 Pick up phone book

2 Open to middle of phone book

3 Look at page

4 If person is on page

5 Call person

6 Else if person is earlier in book

7 Open to middle of left half of book

8 Go back to line 3

9 Else if person is later in book

10 Open to middle of right half of book

11 Go back to line 3

12 Else

13 Quit

83 of 114

1 Pick up phone book

2 Open to middle of phone book

3 Look at page

4 If person is on page

5 Call person

6 Else if person is earlier in book

7 Open to middle of left half of book

8 Go back to line 3

9 Else if person is later in book

10 Open to middle of right half of book

11 Go back to line 3

12 Else

13 Quit

84 of 114

  • functions
    • arguments, return values
  • conditionals
  • Boolean expressions
  • loops
  • variables
  • ...

85 of 114

#include <stdio.h>

int main(void)�{

printf("hello, world\n");

}

86 of 114

print("hello, world")

87 of 114

88 of 114

89 of 114

90 of 114

91 of 114

92 of 114

93 of 114

94 of 114

95 of 114

algorithm

input → 

→ output

96 of 114

algorithm

→ 

→ output

97 of 114

→ 

→ output

98 of 114

→ 

99 of 114

100 of 114

algorithm

input → 

→ output

101 of 114

algorithm

→ 

→ output

102 of 114

→ 

→ output

103 of 114

→ 

104 of 114

105 of 114

algorithm

input → 

→ output

106 of 114

algorithm

→ 

→ output

107 of 114

→ 

→ output

108 of 114

→ 

109 of 114

110 of 114

→ 

111 of 114

→ 

→ 

112 of 114

→ 

→ 

113 of 114

114 of 114

This is CS50