0 1 2 3 4 0 5 6 3 6 4 7 6 0 8 9 3 3 3 3 2 0 3 7 3 3 7 3 3 3 3 7 3 5 9 5 5 2 3 4 1 9 5 9 5 2 3 4 1 5 9 5 2 3 4 1 3 3 3 3 5 2 3 4 1 A A B 5 2 3 4 1 1 4 3 2 5 2 3 4 1 5 4 3 2 1 5 1 2 3 4 5 X The smallest number of flips required to sort X Lower Bound 5 2 3 4 1 Upper Bound X The smallest number of flips required to sort X 4 Lower Bound 5 2 3 4 1 Upper Bound B 5 2 3 4 1 9 1 4 3 2 5 4 1 3 2 5 Flip 1 has to put 5 on bottom Flip 2 must bring 4 to top X 4 Lower Bound 4 X Lower Bound Upper Bound 4 9 P5 The number of flips required to sort the worst case stack of 5 pancakes P5 Lower Bound Upper Bound 9 P5 The number of flips required to sort the worst case stack of 5 pancakes 4 P5 Lower Bound Upper Bound 9 C 1 2 3 X1 X2 X3 5 2 3 4 1 4 C 1 9 9 X119 1 2 0 X120 C 9 E 1 2 3 X1 X2 X3 D 5 2 3 4 1 4 1 9 9 X119 1 2 0 X120 D C 9 E D 3 4 D C 9 E D 3 4 D 3 4 Be Cool Learn Math speak A Can you do n 0 1 2 3 2 D 4 90 B 3 9 Pn The number of flips required to sort a worst case stack of n pancakes Pn Lower Bound Upper Bound A A Take a few minutes to try and prove bounds on Pn for n 3 F B D 3 3 3 9 3 Bring To Top Method For n 1 Pancakes Total Cost at most 2 n 1 2n 2 flips B D 3 3 9 3 Bring To Top Method For n 1 Pancakes Total Cost at most 2 n 2 1 2n 3 flips 5 2 3 4 1 1 4 3 2 5 3 4 1 3 2 5 2 3 1 4 5 3 2 1 4 5 A What bounds can you prove on Pn G G 4 3 3 9 16 G G 4 3 3 B 9 16 H I 3 4 2 4 6 8 n 1 3 5 7 n 1 3 4 5 3 3 J 2 1 3 4 1 3 5 7 n 2 4 6 8 n 1 3 4 5 3 3 J 1 3 2 3 3 So starting from ANY stack we can get to the sorted stack using no more than Pn flips B B 90 90 A 4 3 B 90 B 90 B 90 90 B 90 90 Can you find a faster way than 2Pn flips to go from ANY to ANY B 90 3 90 3 3 4 3 K 3 9 Pn n L M N O D NM MN O A H 53 I N OM M8 L P 8 Bill Gates Christos Papadimitriou Bounds For Sorting By Prefix Reversal Discrete Mathematics vol 27 pp 47 57 1979 8 P 8 H Heydari H I Sudborough On the Diameter of he Pancake Network Journal of Algorithms vol 25 pp 67 94 1997 Q Q DR S Q T U T U Q L 4 3 3 3 4 T U Q DL D D D D L D 9 9 9 9 2Q 3 3 D V V V VF V 9 B 5 B 9 3 3 3 3 9 1 2 3 3 2 1 3 B 2 1 3 2 3 1 D 3 1 2 1 3 2 9 3 B D 9 3 5 3 3 3 A Pn 9 3 3 9 3 5 H I A host of problems and applications at the frontiers of science 7 W B 5 M OMO 5 O OOM M M W 9 3 LM
View Full Document