DOC PREVIEW
CMU CS 15251 - lecture01

This preview shows page 1-2-3-4-27-28-29-30-56-57-58-59 out of 59 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Weekly HomeworkSlide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Developing A Notation: Turning pancakes into numbersHow do we sort this stack? How many flips do we need?4 Flips Are SufficientBest Way to SortFour Flips Are NecessarySlide 20Slide 215th Pancake NumberSlide 23What is Pn for small n?Initial Values of PnP3 = 3nth Pancake NumberBracketing: What are the best lower and upper bounds that I can prove??  Pn  ?Bring-to-top MethodUpper Bound On Pn: Bring-to-top Method For n PancakesBetter Upper Bound On Pn: Bring-to-top Method For n PancakesSlide 33Bring-to-top not always optimal for a particular stack?  Pn  2n-3Breaking Apart Argumentn  PnSlide 38n  Pn  2n – 3 for n > 3From ANY stack to sorted stack in ≤ PnSlide 41ANY Stack S to ANY stack T in ≤ PnThe Known Pancake NumbersP14 is UnknownIs This Really Computer Science?Slide 46(17/16)n  Pn  (5n+5)/3(15/14)n  Pn  (5n+5)/3Slide 49Slide 50Network For n = 3Network For n=4Slide 53Slide 54Mutation DistanceOne “Simple” ProblemHigh Level PointSlide 58Slide 5915-251Cooking for Computer ScientistsI understand that making pancakes can be a dangerous activity and that, by doing so, I am taking a risk that I may be injured.I hereby assume all the risk described above, even if Luis von Ahn, his TAs or agents, through negligence or otherwise, otherwise be deemed liable. I hereby release, waive, discharge covenant not to sue Luis von Ahn, his TAs or any agents, participants, sponsoring agencies, sponsors, or others associated with the event, and, if applicable, owners of premises used to conduct the pancake cooking event, from any and all liability arising out of my participation, even if the liability arises out of negligence that may not be foreseeable at this time.Please don’t burn yourself…Administrative Crapolawww.cs.cmu.edu/~15251Check this Website OFTEN!Course StafInstructorsLuis von AhnAnupam GuptaTAsYifen HuangDaniel NuferDaniel SchaferHomework40%Final25%In-Class Quizzes5%3 In-Recitation Tests 25%Participation5%If Suzie gets 60,90,80 in her tests, how many total test points will she have in her final grade?(0.05)(60) + (0.10)(90) + (0.10)(80) = 20Lowest homework grade is droppedLowest test grade is worth halfGradingWeekly HomeworkTen points per day late penaltyNo homework will be accepted more than three days lateHomework will go out every Tuesday and is due the Tuesday afterAssignment 1:The Great 251 Hunt!You will work in randomly chosen groups of 4The actual Puzzle Hunt will start at 8pm tonightYou will need at least one digital camera per groupCan buy a digital camera for $8 nowadays!Shared SecretCollaboration + CheatingYou may NOT share written workYou may NOT use Google, or solutions to previous years’ homeworkYou MUST sign the class honor codeTextbookThere is NO textbook for this classWe have class notes in wiki formatYou too can edit the wiki!!!((( )))Feel free to ask questionsLecture 1 (August 28, 2007)Pancakes With A Problem!He does this by grabbing several from the top and flipping them over, repeating this (varying the number he flips) as many times as necessaryThe chefs at our place are sloppy: when they prepare pancakes, they come out all diferent sizesWhen the waiter delivers them to a customer, he rearranges them (so that smallest is on top, and so on, down to the largest at the bottom)Developing A Notation:Turning pancakes into numbers5234152341How do we sort this stack?How many flips do we need?523414 Flips Are Sufficient1234552341432152341514325Best Way to Sort52341 X = Smallest number of flips required to sort:?  X  ?Upper BoundLower Bound4Four Flips Are Necessary523414132514325Flip 2 must bring 4 to top (if it didn’t, we would spend more than 3)Flip 1 has to put 5 on bottomIf we could do it in three flips:Upper BoundLower Bound4  X  4X = 4MAX over s 2 stacks of 5 of MIN # of flips to sort sP5 = . . . . . .120111932X1X2X3X119X12052341412345543215th Pancake NumberNumber of flips required to sort the worst case stack of 5 pancakesP5 =5th Pancake Number?  P5  ?Upper BoundLower Bound4MAX over s 2 stacks of n pancakes of MIN # of flips to sort sPn =The number of flips required to sort the worst-case stack of n pancakesPn =What is Pn for small n?Can you do n = 0, 1, 2, 3 ?Initial Values of Pnn 30 1 2Pn0 0 1 3P3 = 3132requires 3 Flips, henceANY stack of 3 can be done by getting the big one to the bottom (≤ 2 flips), and then using ≤ 1 flips to handle the top twoP3 ≥ 3nth Pancake NumberNumber of flips required to sort the worst case stack of n pancakesPn =?  Pn  ?Upper BoundLower BoundBracketing:What are the best lower and upper What are the best lower and upper bounds that I can prove?bounds that I can prove?≤ f(x) ≤[]?  Pn  ?Try to find upper and lower bounds on Pn,for n > 3Bring biggest to top Place it on bottom Bring next largest to topPlace second from bottomAnd so on…Bring-to-top MethodUpper Bound On Pn:Bring-to-top Method For n PancakesIf n=1, no work required — we are done!Otherwise, flip pancake n to top and then flip it to position nNow use: Bring To Top Method For n-1 PancakesTotal Cost: at most 2(n-1) = 2n –2 flipsBetter Upper Bound On Pn:Bring-to-top Method For n PancakesIf n=2, at most one flip and we are done!Otherwise, flip pancake n to top and then flip it to position nNow use: Bring To Top Method For n-1 PancakesTotal Cost: at most 2(n-2) + 1 = 2n – 3 flips?  Pn  2n-3Bring-to-top not always optimal for a particular stackBring-to-top takes 5 flips, but we can do in 4 flips3214552341231454132514325?  Pn  2n-3What other bounds can you prove on Pn?916Breaking Apart ArgumentSuppose a stack S has a pair of adjacent pancakes that will not be adjacent in the sorted stackAny sequence of flips that sorts stack S must have one flip that inserts the spatula between that pair and breaks them apartFurthermore, this is true of the “pair” formed by the bottom pancake of S and the platen  Pn2468..n135..n-1SS contains n pairs that will S contains n pairs that will need to be broken apart during need to be broken apart during any sequence that sorts itany sequence that sorts itSuppose n is even21Detail: This construction only works when n>2n  Pn1357..n246..n-1SS contains n pairs that will S contains n pairs that will need to be broken apart during need to be broken apart during any sequence that sorts itany sequence that sorts itSuppose n is


View Full Document

CMU CS 15251 - lecture01

Documents in this Course
lecture

lecture

66 pages

lecture

lecture

79 pages

lecture

lecture

111 pages

lecture

lecture

85 pages

lecture17

lecture17

64 pages

Lecture

Lecture

85 pages

Lecture

Lecture

71 pages

Lecture

Lecture

70 pages

Lecture

Lecture

11 pages

Lecture

Lecture

45 pages

Lecture

Lecture

50 pages

Lecture

Lecture

93 pages

Lecture

Lecture

93 pages

Lecture

Lecture

35 pages

Lecture

Lecture

98 pages

Lecture

Lecture

74 pages

Lecture

Lecture

13 pages

Lecture

Lecture

15 pages

Lecture

Lecture

66 pages

Lecture

Lecture

82 pages

Lecture

Lecture

15 pages

Lecture

Lecture

47 pages

Lecture

Lecture

69 pages

Lecture

Lecture

13 pages

Lecture

Lecture

67 pages

Lecture

Lecture

68 pages

Lecture

Lecture

69 pages

lecture03

lecture03

44 pages

Lecture

Lecture

69 pages

Lecture

Lecture

68 pages

Lecture

Lecture

55 pages

Lecture

Lecture

79 pages

Lecture

Lecture

85 pages

Lecture

Lecture

87 pages

Lecture

Lecture

85 pages

Lecture

Lecture

103 pages

Lecture

Lecture

9 pages

Lecture

Lecture

83 pages

Lecture

Lecture

8 pages

lecture03

lecture03

68 pages

lecture24

lecture24

78 pages

lecture03

lecture03

72 pages

Thales

Thales

129 pages

lecture13

lecture13

81 pages

Lecture

Lecture

64 pages

lecture11

lecture11

105 pages

Lecture

Lecture

89 pages

Lecture

Lecture

74 pages

lecture25

lecture25

57 pages

Lecture

Lecture

99 pages

lecture

lecture

50 pages

lecture

lecture

14 pages

Lecture

Lecture

78 pages

lecture

lecture

8 pages

Lecture

Lecture

98 pages

lecture

lecture

83 pages

lecture23

lecture23

88 pages

lecture

lecture

64 pages

lecture

lecture

72 pages

Lecture

Lecture

88 pages

lecture

lecture

79 pages

Lecture

Lecture

60 pages

lecture

lecture

74 pages

lecture19

lecture19

72 pages

lecture25

lecture25

86 pages

lecture

lecture

13 pages

lecture17

lecture17

79 pages

lecture

lecture

91 pages

lecture

lecture

78 pages

Lecture

Lecture

11 pages

Lecture

Lecture

54 pages

lecture

lecture

72 pages

lecture

lecture

119 pages

lecture

lecture

167 pages

lecture

lecture

73 pages

lecture

lecture

73 pages

lecture

lecture

83 pages

lecture

lecture

49 pages

lecture

lecture

16 pages

lecture

lecture

67 pages

lecture

lecture

81 pages

lecture

lecture

72 pages

lecture

lecture

57 pages

lecture16

lecture16

82 pages

lecture21

lecture21

46 pages

Lecture

Lecture

92 pages

Lecture

Lecture

14 pages

Lecture

Lecture

49 pages

Lecture

Lecture

132 pages

Lecture

Lecture

101 pages

Lecture

Lecture

98 pages

Lecture

Lecture

59 pages

Lecture

Lecture

64 pages

Lecture

Lecture

106 pages

Lecture

Lecture

70 pages

Lecture

Lecture

80 pages

Lecture

Lecture

76 pages

Lecture

Lecture

91 pages

Lecture

Lecture

112 pages

Lecture

Lecture

91 pages

Lecture

Lecture

10 pages

Lecture

Lecture

39 pages

Lecture

Lecture

79 pages

Lecture

Lecture

74 pages

Lecture

Lecture

44 pages

Lecture

Lecture

39 pages

Lecture

Lecture

99 pages

Lecture

Lecture

44 pages

Lecture

Lecture

59 pages

Lecture

Lecture

36 pages

lecture17

lecture17

36 pages

lecture

lecture

71 pages

lecture

lecture

79 pages

lecture

lecture

12 pages

lecture

lecture

43 pages

lecture

lecture

87 pages

lecture

lecture

35 pages

lecture03

lecture03

23 pages

lecture

lecture

68 pages

lecture

lecture

74 pages

lecture

lecture

21 pages

lecture

lecture

79 pages

lecture

lecture

15 pages

lecture

lecture

83 pages

lecture

lecture

13 pages

Lecture

Lecture

53 pages

lecture

lecture

55 pages

lecture

lecture

49 pages

lecture

lecture

10 pages

lecture

lecture

70 pages

lecture

lecture

12 pages

Lecture

Lecture

105 pages

Lecture

Lecture

9 pages

Lecture

Lecture

72 pages

Lecture

Lecture

66 pages

Lecture

Lecture

54 pages

Lecture

Lecture

98 pages

Lecture

Lecture

57 pages

Lecture

Lecture

75 pages

Lecture

Lecture

48 pages

lecture

lecture

53 pages

Lecture

Lecture

72 pages

Lecture

Lecture

53 pages

Lecture

Lecture

84 pages

Lecture

Lecture

55 pages

Lecture

Lecture

15 pages

Lecture

Lecture

6 pages

Lecture

Lecture

38 pages

Lecture

Lecture

71 pages

Lecture

Lecture

110 pages

Lecture

Lecture

70 pages

lecture

lecture

48 pages

lecture

lecture

76 pages

lecture

lecture

48 pages

lecture

lecture

52 pages

lecture

lecture

43 pages

lecture

lecture

81 pages

lecture

lecture

82 pages

lecture

lecture

83 pages

lecture

lecture

64 pages

lecture

lecture

71 pages

lecture

lecture

65 pages

lecture

lecture

56 pages

lecture

lecture

12 pages

lecture

lecture

66 pages

lecture

lecture

50 pages

lecture

lecture

86 pages

lecture

lecture

70 pages

Lecture

Lecture

74 pages

Lecture

Lecture

54 pages

Lecture

Lecture

90 pages

lecture

lecture

78 pages

lecture

lecture

87 pages

Lecture

Lecture

55 pages

Lecture

Lecture

12 pages

lecture21

lecture21

66 pages

Lecture

Lecture

11 pages

lecture

lecture

83 pages

Lecture

Lecture

53 pages

Lecture

Lecture

69 pages

Lecture

Lecture

12 pages

lecture04

lecture04

97 pages

Lecture

Lecture

14 pages

lecture

lecture

75 pages

Lecture

Lecture

74 pages

graphs2

graphs2

8 pages

lecture

lecture

82 pages

Lecture

Lecture

8 pages

lecture

lecture

47 pages

lecture

lecture

91 pages

lecture

lecture

76 pages

lecture

lecture

73 pages

lecture

lecture

10 pages

lecture

lecture

63 pages

lecture

lecture

91 pages

lecture

lecture

79 pages

lecture

lecture

9 pages

lecture

lecture

70 pages

lecture

lecture

86 pages

lecture

lecture

102 pages

lecture

lecture

145 pages

lecture

lecture

91 pages

Lecture

Lecture

87 pages

lecture

lecture

87 pages

Notes

Notes

19 pages

Lecture

Lecture

50 pages

Lecture

Lecture

13 pages

Lecture

Lecture

97 pages

Lecture

Lecture

98 pages

Lecture

Lecture

83 pages

Lecture

Lecture

77 pages

Lecture

Lecture

102 pages

Lecture

Lecture

63 pages

Lecture

Lecture

104 pages

lecture

lecture

41 pages

lecture

lecture

14 pages

Lecture

Lecture

87 pages

Lecture

Lecture

94 pages

lecture

lecture

9 pages

Lecture

Lecture

96 pages

Lecture

Lecture

72 pages

Lecture

Lecture

35 pages

Lecture

Lecture

77 pages

Lecture

Lecture

98 pages

Lecture

Lecture

48 pages

Lecture

Lecture

66 pages

Lecture

Lecture

53 pages

lecture18

lecture18

101 pages

Lecture

Lecture

10 pages

Lecture

Lecture

70 pages

Lecture

Lecture

12 pages

Lecture

Lecture

74 pages

graphs

graphs

10 pages

Lecture

Lecture

62 pages

Lecture

Lecture

11 pages

Lecture

Lecture

71 pages

Lecture

Lecture

42 pages

lecture15

lecture15

72 pages

Lecture

Lecture

82 pages

Load more
Download lecture01
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view lecture01 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view lecture01 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?