115-251Great Theoretical Ideas in Computer ScienceBits of Wisdom on Solving Problems, Writing Proofs, and Enjoying the Pain: How to Succeed in This Class Lecture 4 (September 3, 2009)What did our brains evolve to do?What were our brainsdesigned to do?Our brains probably did not evolve to do math!Over the last 30,000 years, our brains have essentially stayed the same!The human mind was designed by evolution to deal with foraging in small bands on the African Savannah . . . faulting our minds for succumbing to games of chance is like complaining that our wrists are poorly designed for getting out of handcuffsSteven Pinker“How the Mind Works”2Our brains can perform simple, concrete tasks very wellAnd that’s how math is best approached!Draw simple picturesTry out small examples of the problem: What happens for n=1? n=2?Substitute concrete values for the variables: x=0, x=100, …Terry Tao (Fields Medalist, considered to be the best problem solver in the world)“I don’t have any magical ability…I look at the problem, and it looks like one I’ve already done. When nothing’s working out, then I think of a small trick that makes it a little better. I play with the problem, and after a while, I figure out what’s going on.”ExpertNoviceThe better the problem solver, the less brain activity is evident. The real masters show almost no brain activity!Simple and to the pointUse a lot of paper, or a board!!!Quick Test...Count the green squares(you will have three seconds)3How many were there?Hats with Consecutive NumbersAlice BobAlice starts: …| A - B | = 1Hats with Consecutive NumbersAlice BobAlice starts: …| A - B | = 1 and A, B > 0I don’t know what my number is(round 1)Hats with Consecutive NumbersAlice BobAlice starts: …| A - B | = 1 and A, B > 0I don’t know what my number is(round 2)4Hats with Consecutive NumbersAlice BobAlice starts: …| A - B | = 1 and A, B > 0I don’t know what my number is(round 3)Hats with Consecutive NumbersAlice BobAlice starts: …| A - B | = 1 and A, B > 0I don’t know what my number is(round 4)…Hats with Consecutive NumbersAlice BobAlice starts: …| A - B | = 1 and A, B > 0I know what my number is!!!!!!!!(round 251)Hats with Consecutive NumbersAlice BobAlice starts: …| A - B | = 1 and A, B > 0I know what my number is!!!!!!!!(round 252)Question: What are Alice and Bob’s numbers?5Imagine Alice Knew Right AwayAlice BobI know what my number is!!!!!!!!Then A = 2 and B = 1| A - B | = 1 and A, B > 0(round 1)1,2 N,Y2,1 Y2,3 N,Y3,2 N,N,Y3,4 N,N,N,Y4,3 N,N,Y4,5 N,N,N,YInductive ClaimClaim: After 2k NOs, Alice knows that her number is at least 2k+1.After 2k+1 NOs, Bob knows that his number is at least 2k+2.Hence, after 250 NOs, Alice knows her number is at least 251. If she says YES, her number is at most 252. If Bob’s number is 250, her number must be 251. If his number is 251, her number must be 252.Exemplification:Try out a problem or solution on small examples. Look for the patterns.A volunteer, pleaseRelaxI am just going to ask you a Microsoft interview question6Four guys want to cross a bridge that can only hold two people at one time. It is pitch dark and they only have one flashlight, so people must cross either alone or in pairs (bringing the flashlight). 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?Get The Problem Right!Given any context you should double check that you read/heard it correctly!You should be able to repeat the problem back to the source and have them agree that you understand the issueFour guys want to cross a bridge that can only hold two people at one time. It is pitch dark and they only have one flashlight, so people must cross either alone or in pairs (bringing the flashlight). 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?Four guys want to cross a bridge that can only hold two people at one time. It is pitch dark and they only have one flashlight, so people must cross either alone or in pairs (bringing the flashlight). 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?Intuitive, But False“10 + 1 + 5 + 1+ 2 = 19, so the four guys just can’t cross in 17 minutes”“Even if the fastest guy is the one to shuttle the others back and forth – you use at least 10 + 1 + 5 + 1 + 2 > 17 minutes”7Vocabulary Self-ProofingAs you talk to yourself, make sure to tag assertions with phrases that denote degrees of convictionKeep track of what you actually know – remember what you merely suspect“10 + 1 + 5 + 1 + 2 = 19, so it would be weird if the four guys could cross in 17 minutes”“even if we use the fastest guy to shuttle the others, they take too long.”If it is possible, there must be more than one guy doing the return trips: it must be that someone gets deposited on one side and comes back for the return trip later!Suppose we leave 1 for a return trip laterWe start with 1 and X and then X returns Total time:Thus, we start with 1,2 go over and 2 comes back….2X1 2 5 10 1 2 5 1081 2 5 105 10 2 11 2 5 105 10 2 11 2 5 105 102 5 102 111 2 5 105 102 5 102 111 2 5 105 102 5 1022 111 5 101 2 5 105 102 5 1022 111 5 1091 2 5 105 102 5 1021 22 111 5 105 101 2 5 105 102 5 1021 22 111 5 105 101 2 5 105 102 5 1021 22 111 5 105 101 2 5 105 and 10“Load Balancing”:Handle our hardest work loads in parallel! Work backwards by assuming 5 and 10 walk together1 2 5 105 102 5 1021 22 111 5 105 101 2 5 10Words To The Wise• Keep It Simple• Don’t Fool Yourself10That really was a Microsoft questionWhy do you think that they ask such questions, as opposed to asking for a piece of code to do binary search?• 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 hasRepresentation:Understand the relationship between different representations of the same information or idea1324Abstraction: Abstract away the inessential features of a problem====Toolkit:Name abstract objects and ideas, and put them in your toolkit. Know their advantages and limitations. Exemplification:Try out a problem or solution on small examples. Look for the patterns.11Induction has many guises.Master
View Full Document