Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Computer Science: The Good Parts @jeffcohen

Slide 3

Slide 3 text

The Good Parts Data Structures Algorithms Computational Thinking Culture Complexity

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

A data structure is a way to organize data. Different data structures exist for a reason. Data Structures Algorithms List Array Hash Tree Graph

Slide 6

Slide 6 text

Data Structures Algorithms List Array Hash Tree Graph 2 5 1 9 v

Slide 7

Slide 7 text

Data Structures Algorithms List Array Hash Tree Graph 2 5 1 9 a a[0] a[1] a[2] a[3]

Slide 8

Slide 8 text

Data Structures Algorithms List Array Hash Tree Graph h purple color baseball sport cookies fruit

Slide 9

Slide 9 text

Data Structures Algorithms List Array Hash Tree Graph

Slide 10

Slide 10 text

Data Structures Algorithms List Array Hash Tree Graph h purple color baseball sport cookies fruit

Slide 11

Slide 11 text

Jeff Alice Bob Amy Dave Data Structures Algorithms List Array Hash Tree Graph

Slide 12

Slide 12 text

Jeff Alice Bob Amy Dave Data Structures Algorithms List Array Hash Tree Graph

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Data Structures Algorithms • Who's status updates would I like to see? • What should I buy? • What advertisement would influence my behavior the most right now? • I'm bored. How do I get to the pool? • Our website crashed. How do we get our airplane schedule back to normal?

Slide 15

Slide 15 text

Dijkstra's Algorithm Traveling Salesman Problem Data Structures Algorithms Graph Theory

Slide 16

Slide 16 text

Jeff Alice Bob Amy Dave Data Structures Algorithms List Array Hash Tree Graph

Slide 17

Slide 17 text

Culture: Knowing vs. Understanding

Slide 18

Slide 18 text

Select the data structure that resembles the real-life problem that you’re trying to solve. Data Structures Algorithms

Slide 19

Slide 19 text

An algorithm computes a result by operating upon a data structure. Data Structures Algorithms

Slide 20

Slide 20 text

Data Structures Algorithms

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

Margaret Hamilton Source code of the Apollo Guidance Computer

Slide 23

Slide 23 text

An algorithm computes a result by operating upon a data structure. The complexity of an algorithm depends upon the data structure it is forced to work with. Complexity

Slide 24

Slide 24 text

O( ) O(n) O(log n) O(n^2) Complexity: "Big O" Notation

Slide 25

Slide 25 text

def search(people, name_to_find) for person in people if person.name == name_to_find return person end end return nil end Complexity: "Big O" Notation

Slide 26

Slide 26 text

0 100 200 300 O(n) Complexity: "Big O" Notation

Slide 27

Slide 27 text

def search(people, name_to_find, from = 0, to = nil) to ||= people.count - 1 mid = (from + to) / 2 if name_to_find < people[mid].name search(people, value, from, mid-1) elsif name_to_find > people[mid].name search(people, value, mid+1, to) else people[mid] end end Complexity: "Big O" Notation

Slide 28

Slide 28 text

O(n) 0 100 200 300 O(n) O(log n) Complexity: "Big O" Notation

Slide 29

Slide 29 text

def calculate_total(customer) total = 0 for order in customer.orders do for item in order.line_items do total += item.price end end total end Complexity: "Big O" Notation

Slide 30

Slide 30 text

O(n2) def calculate_total(customer) total = 0 customer.orders.each do |order| order.line_items.each do |item| total += item.price end end total end 0 100 200 300

Slide 31

Slide 31 text

The Test Kitchen

Slide 32

Slide 32 text

http://blog.atom.io/

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

Alan Turing

Slide 35

Slide 35 text

Computer science is not computer programming. It’s the pursuit of understanding how humans think and solve problems. Computational Thinking

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

• Break problems into small pieces. • Focus on one thing at a time. • Follow the recipe of a proof. • Make the invisible visible. • Do the simplest thing that can possibly work. • Describe your problem out loud (rubber ducky!) • There's no problem that another level of indirection can't solve. :-)
 Computational Thinking

Slide 38

Slide 38 text

Grace Hopper

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

You don't manage people; you manage things.
 
 You lead people.

Slide 41

Slide 41 text

Humans are allergic to change. They love to say, "We've always done it this way." I try to fight that.
 
 That's why I have a clock on my wall that runs counter- clockwise.

Slide 42

Slide 42 text

A ship in port is safe; but that is not what ships are built for. Sail out to sea and do new things.

Slide 43

Slide 43 text

Stand on Shoulders

Slide 44

Slide 44 text

Applied Science! • Watch out for nested loops. • Know how to use different data structures. • Solve a problem from first principles. • Try to classify method “complexity” (Big O). • Read the source of code you use. • Learn how to benchmark your code. • Join the tradition of doing something meaningful!
 
 


Slide 45

Slide 45 text

@jeffcohen Jeffrey Cohen csthegoodparts.com Computer Science: The Good Parts