Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Candy bars (3 points) Beeblebrox has a candy bar with n squares. The candy bar is in the shape of an n 1


4. Candy bars (3 points)
Beeblebrox has a candy bar with n squares. The candy bar is in the shape of an n × 1 rectangle, with n ? 1
grooves between the squares. Beeblebrox wants to break the candy bar into n squares, by breaking a piece
along one of its grooves. Each break takes a piece of k squares and breaks it into two pieces, one piece consisting
of a squares and a second piece consisting of the remaining k ? a squares, for some 0 < a < k. Beeblebrox
uses exactly n ? 1 breaks in total.
This is though a game, and Beeblebrox earns points each time he breaks a piece, and Beeblebrox wants to earn
as many points as possible. If Beeblebrox breaks a piece of k squares into two pieces of a and k ? a squares,
then Beeblebrox earns max{a, k ? a} points. (max{x, y} = x if x > y, and otherwise max{x, y} = y.)
1. Suppose that Beeblebrox applies the following strategy T : (1) Repeatedly, n ? 1 times, he takes the
remaining candy bar and break off exactly one piece. Let T(n) denote the total number of points that
Beeblebrox earns, if he starts with a candy bar with n squares. Then we can formulate a recurrence
that measures the total number of points Beeblebrox earns: T(n) = (n ? 1) + T(n ? 1) for n > 1, and
T(1) = 0. Give a closed form for this recurrence, and briefly justify your answer. (No proof is required.)
2. Suppose now that Beeblebrox instead applies the following different strategy S: (2) Beeblebrox takes
any of remaining pieces, and breaks it as evenly as possible. E.g., if a piece has 17 squares, he breaks it
into a piece of 8 squares and another of 9 squares. He repeats this n?1 times, resulting in n pieces, each
consisting of exactly one square. Let S(n) denote the total number of points that Beeblebrox earns, if
he starts with a candy bar with n squares.
(i) Formulate a recurrence S(n) for the strategy S. (You are not asked to solve the recurrence, only to
formulate a recurrence.) Justify your recurrence. (ii) Prove that S(n) ? T(n) by mathematical induction
on n. (Note that a proof by mathematical induction is required.)

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

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

15. What is an agent wholesalers marketing mix?

Answered: 1 week ago