Presentation is loading. Please wait.

Presentation is loading. Please wait.

Substitute: Margaret Ellis

Similar presentations


Presentation on theme: "Substitute: Margaret Ellis"— Presentation transcript:

1 Substitute: Margaret Ellis
Raise Hands if you have taken CS2114 Raise hands if currently taking CS2114 Raise hands if took CS1114 at VT

2 General Problem Solving Strategies
diagraming/externalizing ideas rewriting in symbols divide and conquer enumerate possibilities top down/bottom up solve a simpler problem solve a similar problem look for special cases look for a pattern

3 How can programmers deal with interruptions?
Adapted from Shaffer & McQuain CS 2104

4 Visualization in CS problems
Actual content of problem being solved (architecture, manufacturing, telecommunications...) Graphic displays Interfaces Data structures(arrays, linked lists, stacks, queues, trees) System design diagram (UML class diagrams, workflow, storage) Adapted from Shaffer & McQuain CS 2104

5 Heuristics for Problem Solving (in the small)
Heuristic: A rule of thumb, a way of doing things that might or might not work Goal of problem-solving heuristics: Help us to overcome our own limitations Motivation Working memory Insight Process Emotions.

6 The Mind Three things that your mind does:
Receives/processes external information “Displays” stored information Manipulates information It tends not to do more than one of these well at a time Limited “bandwidth” of attention

7 Consider Brain Resources Computer-Brain Analogy
Need to consider “Resource Allocation”: Memory Amount of space Memory Access for input (learning) Memory Access for output (recall) Information organization Executive Functioning like working memory – RAM/Frontal Lobe Long term memory is storage The Paradox of Choice book by Barry Schwartz Processing Computation Instruction following Automatic behaviors There are many differences! Here’s one reference:

8 Externalizing – Expand Bandwidth!
After motivation and mental attitude, the most important limitation on your ability to solve problems is biological: Working memory is 7 +/- 2 “pieces of information.” You can't change this biological fact. All you can do is take advantage of your environment to get around it. That means, you must put things into your environment to manipulate them. Externalize: write things down, manipulate aspects of the problem (correct representation).

9 Example Remember these numbers: 483 and 627
Now, look away and multiply them in your head.

10 Ball Bounce Example A rubber ball has the property that, on any bounce, it returns to one-third of the height from which it just fell. Suppose the ball is dropped from 108 ft. How far has the ball traveled the fourth time it hits the ground? 212ft Work on your own quietly. DRAW! Now compare with your neighbor

11 Ball Bounce Clicker Choices
160 ft 204 ft 212 ft 320 ft c

12 Externalizing In this example, drawing the picture left your mind free to concentrate on problem solving. Not drawing is probably hopeless, too much to keep track of. To be effective, the drawing needs to be set up right – a diagram of some sort makes a big difference. Externalizing helps you revisit your own thought process Externalizing helps you share your thought process

13 Rectangular Board Example
A rectangular board is sawed into two pieces by a straight cut across its width. The larger piece is twice the length of the smaller piece. This smaller piece is cut again into two parts, one three times the length of the other. You now have three pieces of board. The smallest piece is a 7-inch square. What was the original area of the surface of the board? Try this on your own and draw a picture to solve it. 588 inches squared

14 Rectangular Board Clicker Choices
49 in2 147 in2 441 in2 588 in2 d

15 Straight-line Problems
Problems along one dimension: distance, money, etc. John has a pretty good salary. In fact if the salary of his older brother, Bob, were suddenly doubled, John would make only 100 dollars less than Bob. Bob’s current salary is 50 dollars more than that of the youngest brother, Phil. John makes 600 dollars per week. What is Phil’s salary? Draw a line and put the information onto the line. 300 dollars per week

16 Straight Line Clicker Choices
$300/wk $350/wk $600/wk $650/wk a

17 A Marriage Logic Problem
Tom, Diego, Henry, and Al are married to Madeline, Jane, Sue, and Bai, though not necessarily in that order. Jane, who is Diego’s sister, has five children. Tom and his wife want to wait a few more years before starting a family. Tom has never introduced his wife to Sue, who is carrying on an extramarital affair with Diego. (Madeline is considering telling Diego’s wife about it.) Diego and Henry, by the way, are twin brothers. Who is married to whom? Try this on your own The catch is that if Diego is Jane’s brother so is Henry so Jane isn’t married to either of them

18 Marriage Logic Clicker Choices
Who is Sue’s husband? Tom Diego Henry Al c

19 Matrix Problems How can we organize this information?
Matrix works well in this case Can work on one row/column (e.g., figure out who X is married to. Can work one fact at a time. In this case, we will get pretty far. But we’ll be left with a 2 by 2 box for Henry/Al and Jane/Sue. How do we break it? We need to relate two facts to infer that Diego, Henry, Jane are all siblings.

20 Coins Example Three boys, Joey, Jimmy, and Pete, have between them nine quarters and a total of $2.55 in quarters and nickels. Joey has three nickels, and Jimmy has the same number of quarters. Jimmy has one coin more than Joey, who has four coins. How many nickels each do Jimmy and Pete have? Do this one on your own

21 Coins Clicker Choices Jimmy has 3 nickels and Pete has 2 nickels
Jimmy has 1 nickel and Pete has 2 nickels Jimmy has 2 nickels and Pete has 1 nickel

22 General Problem Solving Strategies
diagraming/externalizing ideas rewriting in symbols divide and conquer enumerate possibilities top down/bottom up solve a simpler problem solve a similar problem look for special cases look for a pattern

23 Hand-Shaking Problem An anthropologist and her husband attended a party with four other married couples. Whenever two people shook hands, the woman recorded that each of the two people shook hands one time. In that way, for all of them (including herself and her husband), she obtained the total number of times that each person shook hands. She noted that one did not shake hands with one’s own spouse, that is each person did not shake hands with their respective spouse. Then she observed: if she didn’t count herself in the final tally, the other nine people all shook hands a different number of times. That is, one person didn’t shake any hands, one shook only once, up to one person shaking hands of all eight of the others. Q: How many times did her husband shake hands? (For the anthropologist, her number of handshakes X equals somebody else’s X )

24 Hand-Shaking Problem This one is difficult. Its tough to engage.
But there are things that can be figured out. You need to play with it awhile.

25 Hand-Shaking Problem This one is difficult. Its tough to engage.
But there are things that can be figured out. You need to play with it awhile. Hint: People who had zero and maximum possible number of handshakes are “special”.

26 Hand-Shaking Problem Bigger hint: Can they be a husband and wife? 26

27 Hand-Shaking Problem Yet another hint: draw the right kind of diagram to show handshakes. Solve a simpler version: just 3 pairs of people. Place H&W next to each other. Draw handshakes. See the pattern. 4 27 27

28 Hand-Shaking Problem Start building the handshake graph, from the special pair. Next, the person who shook hands 3 times. Next 2. But you must have 2 of those! 1 4 3 2 2 28 28

29 Hand-Shaking Problem 3 1 2 4 2-2 2
Now let’s build the graph of husband-wife pairs: 4-0 3-1 2-2 1 4 3 Anthropologist and Husband 2 2 29 29

30 Hand-Shaking Problem So, the the non-unique number occurs half-way between 0 and 4, at 2. You can now guess the answer when the max = 8. It is 4. 1 4 3 2 2 30 30

31 Definition heuristic (adj) - involving or serving as an aid to learning, discovery, or problem-solving by experimental and especially trial-and-error methods; - of or relating to exploratory problem-solving techniques that utilize self- educating techniques (as the evaluation of feedback) to improve performance heuristic (noun) -  the study or practice of heuristic procedure -  a heuristic method or procedure

32 Adapted from 2011-12 Shaffer & McQuain CS 2104
Handshaking Problem Table Approach Adapted from Shaffer & McQuain CS 2104

33 Hand-shaking Problem Basic Facts
Let's arbitrarily let couple #1 be the anthropologist and her husband. C1H1 C1W1 C2H2 C2W2 C3H3 C3W3 C4H4 C4W4 C5H5 C5W5 X No one shakes hands with his/her spouse or herself/himself., so mark those cells with X's. i.e., we make an assumption that has no effect on the nature or existence of a solution Adapted from Shaffer & McQuain CS 2104

34 HS Problem: Case 8 shakes
Suppose the anthropologist's husband shakes hands with 8 people: C1H1 C1W1 C2H2 C2W2 C3H3 C3W3 C4H4 C4W4 C5H5 C5W5 X Mark cells indicating each of those handshakes… Here going case by case - could they be a 0,8 couple? … but now we clearly see it's not possible for anyone (excluding the anthropologist) to shake hands with 0 people. Adapted from Shaffer & McQuain CS 2104

35 HS Problem: Case 7 shakes
Suppose the anthropologist's husband shakes hands with 7 people; arbitrarily suppose he does not shake hands with C2H2: C1H1 C1W1 C2H2 C2W2 C3H3 C3W3 C4H4 C4W4 C5H5 C5W5 X Adapted from Shaffer & McQuain CS 2104

36 HS Problem: Case 7 shakes
Then C2H2 is the only eligible person who can shake hands with no one: C1H1 C1W1 C2H2 C2W2 C3H3 C3W3 C4H4 C4W4 C5H5 C5W5 X Because they are the one with partner to no one… all others are down one becuase of c2h2 shaking with 0 Elliminating possibilies Adapted from Shaffer & McQuain CS 2104

37 HS Problem: Case 7 shakes
But then, C2W2 is the only person who could have shaken hands with 8 people: C1H1 C1W1 C2H2 C2W2 C3H3 C3W3 C4H4 C4W4 C5H5 C5W5 X But now, no eligible person could shake hands with only one person… Adapted from Shaffer & McQuain CS 2104

38 Adapted from 2011-12 Shaffer & McQuain CS 2104
HS Problem Continue in like fashion, assuming the anthropologist 's husband shook hands with 6 people, then 5 people, until you find a case that does not lead to a contradiction. Of course, you should also ask whether more than one case might avoid a contradiction… Backtracking as you solve Adapted from Shaffer & McQuain CS 2104

39 Adapted from 2011-12 Shaffer & McQuain CS 2104
Handshaking in Computer Science Terms The process that establishes communication between two networking devices. For example, when two computers first connect with each other through modems, the handshaking process determines which protocols, speeds, compression, and error-correction schemes will be used during the communication session. Handshaking is necessary at the start of each session because typically the modems differ in their vendor, model, or hardware/software configuration. The handshake ensures that communication is possible despite these differences. Adapted from Shaffer & McQuain CS 2104


Download ppt "Substitute: Margaret Ellis"

Similar presentations


Ads by Google