Week 0
Week 0
Harvard College
Week 0
David J. Malan
[email protected]
0
Counting in Binary
128s 64s 32s 16s 8s 4s 2s 1s
1
Counting in Binary
128s 64s 32s 16s 8s 4s 2s 1s
00000000
00000001
00000010
00000011
00000100
2
Cambridge in Binary
128s 64s 32s 16s 8s 4s 2s 1s
________
________
________
________
________
3
Cambridge in Binary
128s 64s 32s 16s 8s 4s 2s 1s
00000000
00000010
00000001
00000011
00001000
4
FoxTrot in Binary
5
ASCII
6
Welcome to CS 50
Introduction to the intellectual enterprises of computer science.
Algorithms: their design, specification, and analysis. Software
development: problem decomposition, abstraction, data structures,
implementation, debugging, testing. Architecture of computers: low-
level data representation and instruction processing. Computer
systems: programming languages, compilers, operating systems.
Computers in the real world: networks, security and cryptography,
artificial intelligence, social issues. Assignments include extensive
programming in the C language and PHP.
This course, when taken for a letter grade, meets the Core area
requirement for Quantitative Reasoning.
7
Expectations
Attend all lectures and sections
Complete eight problem sets
Take three quizzes
Produce a final project
8
Grades*
Problem Sets (best 7 out of 8) 65%
Quizzes (best 2 out of 3) 20%
Final Project 15%
9
Website
www.fas.harvard.edu/~cs50/
(cs50.org)
10
Email
[email protected]
11
Bulletin Board
12
Books
For Those Less Comfortable
13
Books
For Those More Comfortable
14
Books
For Everyone
15
Books
For Aspiring Hackers
16
Sections
17
Head TFs
18
Supersections
19
Office Hours
20
Virtual Office Hours
21
Lectures
Week 0
22
Lectures
Week 1
#include <stdio.h>
int
main(int argc, char * argv[])
{
printf("hello, world\n");
}
23
Lectures
Week 2
24
Lectures
Week 3
25
Lectures
Week 4
27
Lectures
Week 6
30
Lectures
Week 9
Secure coding.
31
Lectures
Week 10
32
Lectures
Week 11
To be announced.
33
Lectures
Week 12
34
Problem Sets*
Problem Set 0: Scratch
Problem Set 1: C
Problem Set 2: Crypto
Problem Set 3: The Game of 15
Problem Set 4: Forensics
Problem Set 5: Mispellings**
Problem Set 6: Huff’n Puff
Problem Set 7: XHTML + PHP + SQL
35
Final Project*
Make something useful.
Solve an actual problem.
Somehow impact campus.
36
Should I (take CS 50)?
Monday, 9/17, 4p – 5p, Sever 113
Tuesday, 9/18, 4p – 5p, Sever 113
Thursday, 9/20, 4p – 5p, Sever 113
37
Programming
38
Algorithms
1) Stand up.
2) Assign yourself the number 1.
3) Find someone else that is standing up.
(If no one is standing, remain standing until I call on you.)
4) Add your number to that person’s number;
the total is your new number.
5) One of you should then sit down.
6) If you’re still standing, go back to step 3.
39
Algorithms
1) let socks_on_feet = 0
2) while socks_on_feet != 2
3) open sock drawer
4) look for sock
5) if you find a sock then
6) put on sock
7) socks_on_feet++
8) look for matching sock
9) if you find a matching sock then
10) put on matching sock
11) socks_on_feet++
12) close sock drawer
13) else
14) remove first sock from foot
15) socks_on_feet--
16) else
17) do laundry and replenish sock drawer
40
Hello, C!
hello.c
#include <stdio.h>
int
main(int argc, char * argv[])
{
printf("hello, world\n");
}
41
Hello, C!
#include <stdio.h>
int
main(int argc, char * argv[])
{
printf("hello, world\n");
}
10000011 00000001 00010001 00000000 00111101 11111100 01110100 00111101
00000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000
10010000 00000000 00000000 00000000 01010000 00000000 00000111 00110000
00001011 00000001 00001011 00000011 00001010 00000000 00000000 00000000
00000000 00100000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00100000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
01110000 00010000 00000000 00100000 00000001 00000000 00000000 00000000
00000000 00000000 00000000 00100000 00000001 00000000 00000000 00000000
00000000 00000000 00000000 01000000 00000001 00000000 00000000 00000000
00000000 00100000 00000000 01000000 00000001 00000000 00000000 00000000
11111111 11111111 11111111 11111111 11111111 11111111 11111111 11111111
10010000 10000000 00000000 01000000 00000001 00000000 00000000 00000000
00101110 01100100 01111001 01101110 01100001 01101101 01101001 01100011
10110000 00000100 00000000 00100000 00000001 00000000 00000000 00000000
10110000 00000100 00000000 00100000 00000001 00000000 00000000 00000000
10100000 00000001 00000000 00000000 00000000 00000000 00000000 00000000
10110000 00000100 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00100000 00000000 00000000
[...]
42
Hello, Scratch!
Hello1.sb
43
Statements
...
44
Statements
Hello{2,3}.sb
45
Boolean Expressions
...
46
Conditions
...
47
Conditions
Hello{4,5}.sb
48
Loops
49
Loops
Hello{6,7,8}.sb
50
Variables
{Count,Hello9}.sb
51
Threads
Move1.sb
52
Threads
Move2.sb
53
Threads
Hello10.sb
54
Threads
David.sb
55
Events
Marco.sb
56
Oscartime
Oscartime.sb
57
Oscartime
Displaying the Instructions
58
Oscartime
Making Trash Fall
59
Oscartime
Implementing Dragging
60
Oscartime
Imposing a Time Limit
61
Oscartime
Keeping Score
62
Oscartime
Raising Oscar’s Lid
63
Scratch Meets C
int
main(int argc, char * argv[])
{
printf("hello, world\n");
}
64
Statements
Scratch v. C
printf("hello, world\n");
65
Boolean Expressions
Scratch v. C
(x < y)
((x < y) && (y < z))
66
Conditions
Scratch v. C
if (x < y)
{
printf("x is less than y\n");
}
else if (x > y)
{
printf("x is greater than y\n");
}
else
{
printf("x is equal to y\n");
}
67
Loops
Scratch v. C
while (1)
{
printf("Hello!\n");
}
68
Variables
Scratch v. C
int counter = 0;
while (1)
{
printf("%d\n", counter);
counter++;
}
69
Computer Science 50
Introduction to Computer Science I
Harvard College
Week 0
David J. Malan
[email protected]
70