To cut an 'n' centimeter-long gold bar into 2 pieces costs $n. When a gold bar is cut into many pieces, the order in which the cuts occur can affect the total amount of costs. For example, to cut a 20 centimeter gold bar at length marks 2, 8, and 10 (numbering the length marks in ascending order from the left-hand end, starting from 1). If the cuts to occur in left-to-right order, then the first cut costs $20, the second cut costs $18 (cutting the remaining 18 centimeter bar at originally length mark 8), and the third cut costs $12, totaling $50. If the cuts to occur in right-to-left order, however, then the first cut costs $20 time, the second cut costs $10, and the third cut costs $8, totaling $38. In yet another order, the first cut is at 8 (costing $20), then the 2nd cut is at 2 (costing $8), and finally the third cut is at 10 (costing $12), for a total cost of $40. Given an 'n' centimeter-long gold bar G and an array C[1..m] containing the cutting points in ascending order): a. Formulate the recursive relation of the optimal solution; b. Design a bottom-up algorithm (pseudo code) to calculate the lowest cost for a sequence of cuts c. Analyze the complexity of your algorithm d. Write an algorithm (pseudo code) to print out a sequence of cuts that achieves this cost.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

To cut an 'n' centimeter-long gold bar into 2 pieces costs $n. When a gold bar is cut into many pieces, the order in which the cuts occur can affect the total amount of costs. For example, to cut a 20 centimeter gold bar at length marks 2, 8, and 10 (numbering the length marks in ascending order from the left-hand end, starting from 1). If the cuts to occur in left-to-right order, then the first cut costs $20, the second cut costs $18 (cutting the remaining 18 centimeter bar at originally length mark 8), and the third cut costs $12, totaling $50. If the cuts to occur in right-to-left order, however, then the first cut costs $20 time, the second cut costs $10, and the third cut costs $8, totaling $38. In yet another order, the first cut is at 8 (costing $20), then the 2nd cut is at 2 (costing $8), and finally the third cut is at 10 (costing $12), for a total cost of $40. Given an 'n' centimeter-long gold bar G and an array C[1..m] containing the cutting points in ascending order):

a. Formulate the recursive relation of the optimal solution;
b. Design a bottom-up algorithm (pseudo code) to calculate the lowest cost for a sequence of cuts

c. Analyze the complexity of your algorithm
d. Write an algorithm (pseudo code) to print out a sequence of cuts that achieves this cost.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY