Presentation is loading. Please wait.

Presentation is loading. Please wait.

DW Daniel High, SC; Jan 25, 2010 Murali Sitaraman

Similar presentations


Presentation on theme: "DW Daniel High, SC; Jan 25, 2010 Murali Sitaraman"— Presentation transcript:

1 A bit of Computer Science is good for you no matter what you want to do
DW Daniel High, SC; Jan 25, 2010 Murali Sitaraman RESOLVE Software Research Group Google Terms: Clemson RESOLVE School of Computing, Clemson

2 Acknowledgments Fox Filmed Entertainment Marvel Studios
New York Times (Jan 24, 2010) Software Development Topics, Timm Martin 1001Crash.com US National Science Foundation

3 Computer Science is fun

4 Computer Science is fun

5 Computer Science is everywhere

6 Computer Science is everywhere

7 Computer Science is everywhere

8 CS is serious business Link

9 CS is serious business

10 CS is serious business

11 CS has applications everywhere
Arts Math Medicine Physical Sciences Engineering Finances and management So job prospects are excellent with some computer science, but this talk is not about that

12 What you learn in CS CS is as much about computers as teaching is about blackboards Not just about games or programming Something a lot more fundamental… Abstraction Analysis Mathematical logic Problem solving These fundamentals will help you no matter what your major is

13 Let’s play

14 Let’s play tic-tac-toe
Play with your friend a few times Figure out a strategy

15 Let’s play tic-tac-toe
Play with your friend a few times Figure out a strategy (“algorithm”) Can you always win? Do you always lose?

16

17

18

19

20

21 Do the colors matter?

22 Do the shapes matter?

23 What matters?

24 Abstraction For the present problem
Understand what is relevant Ignore the irrelevant It is the only way we can get a handle on large, complex problems There is a huge gap between the problems and the electrons running around in the computers There are several layers of abstraction Electrons, bits, bytes, programs are all abstractions!

25 Strategies for solving tic-tac-toe
Pick the middle square, if it is not taken ???

26 Strategies for solving tic-tac-toe
If it is not taken Pick the middle square Pick a square if it would stop the other person from winning ???

27 Strategies for solving tic-tac-toe
If it is not taken Pick the middle square Pick a square if you would lose by not picking it! Pick a square if it would help you win!!

28 A step-by-step procedure
If it is not taken Pick a square if it would help you win!! Pick a square if you would lose by not picking it! Pick the middle square Pick a corner square (any one?) Pick a center-edge square (any one?) ???

29 A program Repeat the following steps forever 1. If it is not taken
Pick a square if it would help you win!! Pick a square if you would lose by not picking it! Pick the middle square Pick a corner square (any one?) Pick a center-edge square (any one?) 2. Quit if no square is available

30 A program Repeat the following steps forever 1. If it is not taken
Pick a square if it would help you win!! Pick a square if you would lose by not picking it! Pick the middle square Pick a corner square (any one?) Pick a center-edge square (any one?) 2. Draw a Circle; color it green; … 3. Quit if no square is available

31 Generalization Questions
Can you write a program for a 4 by 4 tic-tac-toe board? 5 by 5? n by n? 3-dimensional tic-tac-toe? k-dimensional tic-tac-toe? m by n, when m is not equal to n? What does it mean to win? What if some squares are blocked, i.e., no one can move there?

32 Even More Questions Can the first player always win 3 by 3 tic-tac-toe? 2 by 2 tic-tac-toe? 3 by 3 by 3?

33 Toy problems to real ones
Chess Deep Blue vs. Kasparov Map quest No adversary, but you’re trying to reach a goal through a bunch of moves; Closed roads are like blocked squares Wall street investment Airline reservations Computer is not intelligent; but the instructions better be!

34 Basic questions about strategies
Is our strategy efficient? Is it correct, i.e., can we guarantee the strategy will always work?

35 More Problem Solving Ask your friend to guess a mystery number between 1 and 10 You can ask your friend only yes or no questions Figure out a strategy to find out the number

36 More Problem Solving How many questions did you have to ask to unearth the mystery? What is the best case? What is the worst case?

37 Approach 1: Random Pick a new number at random and ask if it is the mystery number

38 Approach 2: Linear Start from number 1 and ask if it is the mystery number

39 Approach 3: Novel? Is the number odd? If yes, is it divisible by 3?
If yes, is it 3? Done. If not, is it prime? If yes, is it 5? Done. If not, Done If not, is it divisible by 4? If yes, is it 4? Done. If yes, done. If not, is it 6? Done.

40 Approach 4: Binary Search
Is the number greater than 5? If yes, is it greater than 8? If yes, is it greater than 9? Done. If not, is it greater than 7? If yes, done. If not, is it greater than 6? Done. If not, is it greater than 3? If yes …

41 Analysis of the Approaches
Approach 1 (random) vs 2 (linear) Best case 1 worst case 10 Random approach is more entertaining, but needs to store previous guesses Approach 3 (novel) vs 4 (binary) Best case 3 worst case 4 Novel approach is more entertaining, but requires more bookkeeping

42 Linear and Binary Searches
Suppose it takes 1 millisecond to ask a question and get an answer To guess a number between 1 and 10,000,000 Linear search requires about 3 days Binary search requires about 24 milliseconds Google would be really slow if it depended totally on linear search!

43 Software Correctness First, we specify what problem needs to be solved
Then we develop an efficient strategy for solving it and code it We can run code on some examples and see if it works (testing) Without ever running the code, we can prove that code is correct using mathematical logic! Software is unique in this way. Can’t do this for physical devices; they have wear and tear!

44 Example Problem Specification
Find the nearest, but smaller “whole number” square root of a given positive number For 25, the answer I want is 5 For 28, the answer I want is also 5 Can you specify what I want? Suppose x is the number I give you. Suppose y is the answer. What is the relationship between x and y?

45 Problem Specification: Goal
Can you specify what I want? Suppose x is a positive number I give you. Suppose y is the answer. What is the relationship between x and y? Goal: Find y such that (y * y) ≤ x ≤ (y + 1) * (y + 1)

46 Linear Search Suppose x = 10,050. What is y? Try y = 1. Try y = 2.
Try y = 99. Try y = 100. Success!

47 Binary search Suppose x = 10, 050. What is y? Try y = 1. Try y = 2.
Try y = 64. Try y = Too big. Try y = ( )/2 = 96. Too small. Try y = ( )/2 = Too big. Try y = ( )/2 = Too big. Try ( )/2 = Just right!

48 Is the binary search approach correct?
Will it always terminate? Will it always produce y that satisfies the goal? (y * y) ≤ x ≤ (y + 1) * (y + 1) We can prove both these claims using mathematical logic, automatically!

49 RESOLVE Research at Clemson

50 Logical proofs because…

51 Logical proofs because…

52 Logical proofs because…

53 Logical proofs because…

54 Notable Software Disasters
Mariner bugs out (1962, $18.5 M) Hartford Coliseum Collapse($90M, ‘78) CIA gives Soviets the gas (priceless, ‘82) World War III…Almost (‘83) Medical Machine Kills (‘85) Medical Machine Kills (2009) 20 Famous Software Disasters

55 Frontiers… What problems can be solved with software?
What problems are tractable? For the problems that are tractable, are the present solutions the best we can get? How do we design programs so that they can be proved correct? Would software help you remotely “drive” your kids to school some day?


Download ppt "DW Daniel High, SC; Jan 25, 2010 Murali Sitaraman"

Similar presentations


Ads by Google