Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction: Content And Method Professors Steven Rudich and Bruce Maggs Carnegie Mellon University CS 15-251 Lecture 1.

Similar presentations


Presentation on theme: "Introduction: Content And Method Professors Steven Rudich and Bruce Maggs Carnegie Mellon University CS 15-251 Lecture 1."— Presentation transcript:

1

2 Introduction: Content And Method Professors Steven Rudich and Bruce Maggs Carnegie Mellon University CS 15-251 Lecture 1

3 Moral: BE PUNCTUAL! Or else you will miss the magic tricks that happen at 3:00pm sharp. Sit close-up: some of the tricks are hard to see from the back.

4 Course Staff Steven Rudich Bruce Maggs A: Cory Williams B: Pat Riley C: Jason Crawford D: Dominic Mazzoni *: Ke Yang

5 A volunteer, please.

6 Putting You On The Spot Four guys want to cross a bridge in the dark of night. They have one flashlight and the bridge can hold only two people at once. Their walking speeds allow them to cross in 1, 2, 5, and 10 minutes, respectively. Is it possible for them to all cross in 17 minutes in such a way that no one walks in the dark?

7 You have one minute to solve this problem Four guys want to cross a bridge in the dark of night. They have one flashlight and the bridge can hold only two people at once. Their walking speeds allow them to cross in 1, 2, 5, and 10 minutes, respectively. Is it possible for them to all cross in 17 minutes in such a way that no one walks in the dark?

8

9 That was a Microsoft interview question.

10 Why do you think that they ask such questions, as opposed to asking for a piece of code to do binary search? That was a Microsoft interview question.

11 Content: An up to date grasp of fundamental problems and solutions Method: Principles and techniques to solve the vast array of unfamiliar problems that arise in a rapidly changing field The future belongs to the computer scientist who has

12 Course Content A survey of fundamental theoretical ideas in Computer Science as they occur in a variety of important applications An introduction to discrete mathematics Effective problem solving, learning, and communication techniques

13 Please feel free to ask questions!

14 Course Document Let’s examine it together:

15 Should I Take The Course? PROS Challenging Cutting Edge Syllabus – No Text Like It Important – Good For Your Future Fun CONS Very Hard No Text -- Impairs Learning For Some Students Lowers GPA – Bad For Your Future “Like Hitting Myself In The Head With A Brick”

16 Course Content A survey of fundamental theoretical ideas in Computer Science as they occur in a variety of important applications An introduction to discrete mathematics Effective problem solving, learning, and communication techniques

17 A survey of fundamental theoretical ideas in Computer Science as they occur in a variety of important applications For example...

18 Growth Rates Input Size Time

19 Recursion ? ?

20 Randomization

21 Hashing

22 Self Reference

23 Reduction =

24 Parallel Versus Sequential Work

25 Dating

26 Private Communication

27 Factoring / Multiplication p, q pq

28 An introduction to discrete mathematics

29 Count without counting: Estimate, Calculate, Analyze

30 Induction has many guises. Master their interrelationship. Formal Arguments Loop Invariants Recursion Algorithm Design Recurrences

31

32 Map Coloring

33 Effective problem solving, learning, and communication techniques

34 Exemplification: Try out a problem or solution on small examples.

35 Representation: Understand the relationship between different representations of the same information or idea 1 2 3

36 Modularity: Decompose a complex problem into simpler subproblems

37 Abstraction: Abstract away the inessential features of a problem =

38 Refinement: The best solution comes from a process of repeatedly refining and inventing alternative solutions

39 Build your toolbox of abstract structures and concepts. Know the capacities and limits of each tool.

40 Similarity: A significant form of intellectual progress is to be able to classify and manipulate distinct objects with regard to a sense in which they are similar. = 13 = 21 (modulo 2)

41 Please feel free to ask questions!

42 ((( ))) Stationary HandWiggling Hand You have a question or comment of any nature spoken now You have something relevant to say to what is being spoken now

43 How many yellow dots on this page?

44 Gauss

45 1+2+3+...+ n-1+n=S n+n-1+n-2+... +2+1=S (n+1) + (n+1) + (n+1) +... + (n+1) + (n+1) = 2S n (n+1) = 2S

46 1+2+3+...+ n-1+n=S n+n-1+n-2+... +2+1=S (n+1) + (n+1) + (n+1) +... + (n+1) + (n+1) = 2S n (n+1) = 2S

47 1+2+3+...+ n-1+n=S n+n-1+n-2+... +2+1=S (n+1) + (n+1) + (n+1) +... + (n+1) + (n+1) = 2S n (n+1) = 2S

48 1+2+3+...+ n-1+n=S n+n-1+n-2+... +2+1=S (n+1) + (n+1) + (n+1) +... + (n+1) + (n+1) = 2S n (n+1) = 2S

49 Let’s restate this argument using a geometric representation Algebraic argument

50 1 2........ n = number of white dots.

51 1 2........ n = number of white dots = number of yellow dots n....... 2 1

52 n+1 n+1 n+1 n+1 n+1 = number of white dots = number of yellow dots n n n n n n There are n(n+1) dots in the grid

53 n+1 n+1 n+1 n+1 n+1 = number of white dots = number of yellow dots n n n n n n

54 Gauss A first glance, these problems appeared unrelated, but a representational change revealed a correspondence. An extension of the similarity principle is that when we come to understand that seemingly unrelated things are related, we are making intellectual progress.

55 Appreciate Alternative Solutions To The Same Problem The expert student takes the opportunity to think through the similarities and differences between the approaches When presented with multiple solutions many students remember only the one that they find easiest to understand. The expert student takes the opportunity to think through the similarities and differences between the approaches. Such meditations lay the foundations for effective learning and problem solving.

56 A volunteer, please.

57 Martial Arts 101 The novice makes a huge motionThe novice makes a huge motion The black belt makes a small motionThe black belt makes a small motion The master makes a tiny motionThe master makes a tiny motion

58 Scanning the brains of master problem solvers The better the problem solver, the less brain activity is evident. The real masters show almost no brain activity! The better the problem solver, the less brain activity is evident. The real masters show almost no brain activity! Simple and to the point

59 Aside to college students It is natural to think that you are really getting your money’s worth when the professor says very complicated things, but the real value is when the professor makes complex things simple. Value Simplicity

60 Aside to college students A good martial arts student will attentively repeat each fundamental technique many times. In contrast, many college students tune out when a concept (e.g., depth first search) is taught more than once. The better students listen carefully in order to refine and develop their understanding. Repetition Is An Opportunity

61 If you value simplicity, listen actively to repeated points, and work through the correspondences between different solutions, you are on your way to a lifetime of effective learning and thinking. With diligence, you may someday reduce your brain activity to zero!

62 The Master Programmer The master seeks an algorithm that will use as small an amount of computer resources (e.g., time, space, communication) as possible. Most “expert” programmers (black belts) will miss the best program because they did not have the patience to refine their solutions further.

63 A case study. Anagram Programming Task. You are given a 70,000 word dictionary. Write an anagram utility that given a word as input returns all anagrams of that word appearing in the dictionary.

64 Examples Input: CAT Output: ACT, CAT, TAC Input: SUBESSENTIAL Output: SUITABLENESS

65 Impatient Hacker (Novice Level Solution) Loop through all possible ways of rearranging the input word Loop through all possible ways of rearranging the input word –Use binary search to look up resulting word in dictionary. –If found, output it

66 Performance Analysis: Counting Without Executing

67 “Expert” Hacker (Black Belt Level) Subroutine ANAGRAM(X,Y) returns TRUE exactly when X and Y are anagrams. It works by sorting the letters in X and Y Input X Loop through all dictionary words Y –If ANAGRAM(X,Y) output Y

68 Comparing an input word with each of 70,000 dictionary entries takes about 15 seconds. The hacker is satisfied and reflects no further

69 The master keeps trying to refine the solution. The master’s program runs in less than 1/1000 seconds.

70 Master Solution Don’t keep the dictionary in sorted order! Rearranging the dictionary into anagram classes will make the original problem simple.

71 Suppose the dictionary was the list below. ASP DOG LURE GOD NICE RULE SPA

72 After each word, write its “signature” (sort its letters) ASPAPS DOGDGO LUREELRU GODDGO NICECEIN RULEELRU SPAAPS

73 Sort by the signatures ASPAPS SPAAPS NICECEIN DOGDGO GODDGO LUREELRU RULEELRU

74 Master Program Input word W X := signature of W Use binary search to find the anagram class of W and output it.

75 Of course, it takes about 30 seconds to create the dictionary, but it is perfectly fair to think of this as programming time. The building of the dictionary is a one-time cost that is part of writing the program.

76 Neat! I wish I had thought of that.

77 Learning Advice Whenever you see something you wish you had thought of, try and formulate the minimal and most general lesson that will insure that you will not miss the same thing the next time. Name the lesson to make it easy to remember.

78 NAME: Preprocessing It is sometimes possible to pay a reasonable, one-time preprocessing cost to reorganize your data in such a way as to use it more efficiently later. The extra time required to preprocess can be thought of as additional programming effort.

79 Content and Method


Download ppt "Introduction: Content And Method Professors Steven Rudich and Bruce Maggs Carnegie Mellon University CS 15-251 Lecture 1."

Similar presentations


Ads by Google