Ask your own question, for FREE!
Mathematics 20 Online
OpenStudy (calculusxy):

You have invited a group of friends over for breakfast and need to make n ≥ 1 pancakes using a skillet that can hold only two pancakes at a time. Each pancake has to be cooked on both sides; cooking one side of a pancake takes 1 minute, regardless of whether one or two pancakes are cooked at the same time. Design an algorithm to do this job in the minimum amount of time. Also, determine the minimum amount of time it takes as a function of n.

OpenStudy (calculusxy):

@phi

OpenStudy (phi):

this sounds like computer programming. what class is this ?

OpenStudy (calculusxy):

Computer science

OpenStudy (calculusxy):

@phi

OpenStudy (phi):

if n is even, then you can cook them "normally" two at a time first cook the bottoms then cook the tops then move to the next pair

OpenStudy (phi):

if n=3, you can cook them A_bottom B_bottom take B out then cook A_top C_bottom take A out cook B_top C_top

OpenStudy (calculusxy):

Since they didn't specify do I need to include both the even and the odd numbers?

OpenStudy (phi):

I assume you can make progress with that ?

OpenStudy (calculusxy):

I am still not sure of what to do since they didn't specify the numbers?

OpenStudy (phi):

the answer is a function of n if n=1 just cook 1_top and 1_bottom, total time 2 minutes

OpenStudy (calculusxy):

So I want to clarify the algorithm with you.

OpenStudy (calculusxy):

Do I need to write that the procedures by saying if n=1 or n=2 or n=3?

OpenStudy (phi):

I'm thinking of using recursion

OpenStudy (phi):

it would look (something) like if n=0 return; (do nothing) if n=1 then cook 1 pancake, flip, cook other side, return else if n is odd then cook(3), cook(n-3), return else cook 2 pancakes, flip both, cook other side, cook(n-2), return

OpenStudy (phi):

the program could "print out" the instructions as it runs

OpenStudy (phi):

I think the min time will be if n==1 then 2 else n i.e. if you are cooking n pancakes, it will take n minutes (except for the case of 1 pancake, which will take 2 minutes)

OpenStudy (calculusxy):

@Hero

OpenStudy (calculusxy):

Can you please elaborate on the steps that @phi showed? I am still confused.

hero (hero):

Just wait until @phi gets back. I don't want to interfere with his reasoning.

OpenStudy (calculusxy):

@Hero this is due tomorrow. Please help me!

hero (hero):

Here you go: You might find what you're looking for here: http://web.engr.illinois.edu/~jeffe/teaching/algorithms/all-algorithms.pdf

OpenStudy (calculusxy):

Can you actually help me with the function for finding the minimum amount of time?

OpenStudy (calculusxy):

I am pretty sure I will be able to get through to find an algorithm, but I am not sure by what they meant with the functions.

hero (hero):

Truth is, I have a host of other things on my plate that I need to do now. I don't really have the time to help you with this.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!