Question: Design an algorithm to solve the given problem. Submit an implementation for this algorithm in C++, PHP or Python. Indicate the runtime of your

 Design an algorithm to solve the given problem. Submit an implementation for this algorithm in C++, PHP or 

Design an algorithm to solve the given problem. Submit an implementation for this algorithm in C++, PHP or Python. Indicate the runtime of your solution. A large wholesale company, Jewels And Gemstones - Upscale And Restricted, has developed an odd way of selling their merchandise to jewelers. JAGUAR's employees carefully shape their gemstones so that each stone of the same type is precisely the same weight and market value. Then they mix together all of the different types of gemstones and pour some into each of a series of strong lead caskets. The caskets are each tightly sealed (in a way that prevents them from being opened surreptitiously) and then taken to auction. Jewelers attending the auction are told the types of stones that went into the mixture in the caskets, but when bidding on any one casket, they are told only the total weight of the gemstones in it and nothing about the composition. JAGUAR obviously hopes to benefit from jewelers overbidding on caskets of lower value. One local jeweler, Bartholomew Tempilken ("That's my real name," he assured you at your first meeting with him. "No pun intended.") has had a few costly purchasing experiences at JAGUAR's auctions and wants to be prepared next time. He has hired you write a program that calculates the minimum value of some casket, based on weight and data about stones in the mixture. Mr. Tepilken plans to bid exactly the minimum possible value for each casket, so he is guaranteed at least not to overpay and maybe even be surprised with a more valuable collection than expected. Write a function minimumCasket Value that accepts two arrays - one with gemstone weights (in milligrams), one with gemstone values (in Swedish kronor) - and a number indicating total weight of the gemstones in the casket. You may assume that all input values are integers. Calculate and return the minimum market value of the stones. Based on the company's long established patterns of fairness and honesty (despite their unusual sales approach), you may assume in your program that the total weight is possible, given the weights of gemstones potentially included. For full points, your solution must implement a dynamic programming approach. Partial credit may be given for correct but less efficient solutions.

Step by Step Solution

3.38 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Code def minimumCasketValueweights values totalweight n lenweights dp floatinf totalweight 1 dp0 ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!