Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Pancake aesthetics. A diner serves a breakfast plate which simply consists of n pancakes A very bad cook fills the order. He proceeds by

image text in transcribed

1. Pancake aesthetics. A diner serves a breakfast plate which simply consists of n pancakes A very bad cook fills the order. He proceeds by making n pancakes-all of different sizes and all with one side burnt. He then piles the pancakes onto a plate to create a tower of pancakes. Mr. Waiter picks up the plate and immediately realizes that he has to make the plate presentable. He wants to (i) sort the pancakes from smallest to largest with the largest pancake at the bottom of the plate, and (ii) hide the burnt side of each pancake. Now he only has one move available to him push a spatula underneath one of the pancakes and then flip the entire subtower of pancakes above the spatula upside down. His goal is to use this move repeatedly until his goals are accomplished. How many moves does he need? Let's create a mathematical model for this problem. Represent the ith smallest pancake as i if the pancake has its good side facing up and as -i if its burnt side is facing up Let the array .. .. n] store the pancakes on the plate created by the bad cook. In particular, Plj] refers to the jth pancake from the top. Thus, for n 5 the input array can look like this: P-3, 2,4, -1,-5] Let flip(i), 1 i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Publishing With Filemaker Pro On The Web

Authors: Maria Langer

1st Edition

0201696657, 978-0201696653

More Books

Students also viewed these Databases questions

Question

Show that if tan = c and 0 Answered: 1 week ago

Answered: 1 week ago

Question

1. What are your creative strengths?

Answered: 1 week ago

Question

What metaphors might describe how we work together?

Answered: 1 week ago