The cook at the Sunrise Cafe is sloppy. When she prepares pancakes, they all come out a different size. The server, however, is tidy. Before he delivers a stack to a customer, he rearranges the pancakes in order of size, with the smallest one on top and the largest on the bottom. To do so, he grabs several pancakes from the top and flips them over. He repeats this “grab-and-flip” operation as many times as necessary, varying the number of pancakes that he flips each time. If he has a stack of n pancakes, what’s the maximum number of flips that he’ll ever need to use to rearrange them?
The original pancake problem was posed in 1975 in the American Mathematical Monthly by Jacob E. Goodman, writing under the name “Harry Dweighter” (or “Harried Waiter”). It attracted considerable attention in subsequent years and has since become a staple of theoretical computer science courses.