Question

3. [10 marks] Suppose we would like to buy n items from SuperCheapStore (SCS); all items are currently priced at 1 CAD. Unfortunately there is no delivery and we have to deliver them home. The bad news are: we can fit only 1 item in our truck: it takes one day to drive home and back. There is even worse news -SCS charges us for the storage of undelivered items and the charge for storage of te i growth exponentially as original price times factor c 1 each day. It means that if item i is picked up d days from now, the charge will be 1 CAD In which order should we pick up our items from SCS so that total amount of charges is as small as possible. Develop a greedy algorithm to solve this problem assuming that Gメc, for iメJ. Prove that your algorithm gives an optimal solution. What is the running time of your algorithm?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Algorithm:

Step 1: For all items bought , sort them in the decreasing order of their cj . i.e ( if cj of an item is maximum , it will be at first, if is least it will be last.).

Step 2: Load the items in truck in the same sorted order i.e if an item has highest cj, it will be loaded on first day, if it has least it will be loaded on last day.

Step 3: For each item in the bought list, follow the step 2, and calculate extra charge to be paid for all un delivered item.

Optimal Solution:

                               If we load the item in truck in any random order of cj, the sum of extra charge calculated for each item won’t be as small as possible as the item with highest cj may be picked at last which leads to automatic sum of extra charge for all items to be more than by the algorithm described above. For any other way of loading the items bought into the truck, the sum of extra charges will be more than calculated from above algorithm. Thus above solution is optimal.

Running time: If n is the number of items bought.

=O(sorting the items as described in the algorithm)

=O(nlogn)

Add a comment
Know the answer?
Add Answer to:
3. [10 marks] Suppose we would like to buy n items from SuperCheapStore (SCS); all items...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • QUESTION 3 (10 Marks) Suppose you are given an array A[0..n 1 of integers, each of...

    QUESTION 3 (10 Marks) Suppose you are given an array A[0..n 1 of integers, each of which may be positive, negative, or zero. A contiguous subarray A|i..j] which includes all the items starting at array index i and ending at array index j is called a positive interval if the sum of its entries is at least zero. For example let A-{-1, 3,-5, 2, 0,-4, 3,-6,-2). Ten A[3, 6) is a positive interval since its sum is 2+0+(-4)+3-1, but Al4,7isnot...

  • RUBRICS FOR ASSESMENT: 1. All relevant and meaningful answers will be accepted: 3 marks 2.The length...

    RUBRICS FOR ASSESMENT: 1. All relevant and meaningful answers will be accepted: 3 marks 2.The length of the answers can be from 1 to 3 sentences: 2 marks 3. Use of your own words in writing the answers is encouraged:3 marks 4. The meanings of words or phrases, when asked, should be provided in context: 2marks NEW YEAR RESOLUTION The New Year is the time for resolution. Mentally, at least most of us could compile formidable lists of 'do's and...

  • What are your top 3 takaways from this article? It’s always tempting to see the present...

    What are your top 3 takaways from this article? It’s always tempting to see the present moment as the peak of chaos and disruption, whether we’re talking about politics or just how those teenagers behave today. The same is true in marketing, because in many ways that profession is always in a state of chaos and disruption. But I don’t think it’s hyperbole to apply “peak chaos and disruption” to social media marketing in the first quarter of 2018. Let’s...

  • Please see the articles below… 1.  What is your opinion on the subject? 2.  Which ethical views (i.e.,...

    Please see the articles below… 1.  What is your opinion on the subject? 2.  Which ethical views (i.e., utilitarian view, moral rights view, justice view, practical view) you feel are being used by both sides of the argument (i.e., for and against downloading) to justify their positions? High Court Enters File-Sharing Spat; Justices Must Determine Software Providers' Liability For Copyright Violations by Anne Marie Squeo. Wall Street Journal. (Eastern edition). New York, N.Y.: Mar 30, 2005. pg. A.2 WASHINGTON -- The Supreme...

  • Help needed for Project procurement to answer Questions 1-10: Building Trust   Pauly Shore is a junior...

    Help needed for Project procurement to answer Questions 1-10: Building Trust   Pauly Shore is a junior procurement manager for the Goldwell Restaurant Group. He is responsible for the procurement of IT commodities for the data center. After months of negotiating with the three best and lowest-priced bidders for the computer paper contract, Pauly selected Frankie’s Paper Company.  Pauly’s decision was made after a round of golf at Frankie’s country club. On the eighteenth hole, Frankie extended his hand to Pauly and...

  • internal project 1 anything helps! thank you!! Instructions: Study the case that starts on page 3...

    internal project 1 anything helps! thank you!! Instructions: Study the case that starts on page 3 carefully. Then write concise answers to the following questions regarding the internal control system of Duarf, Inc. Clearly label your responses with proper headings and subheadings. Be very specific and precise. Answers that appear to be beating around the bush will not get any credit. 1. What are the controls in place that under normal conditions should function well to prevent embezzlements or frauds?...

  • Here the handout along with the template of what we need to complete. Thank you! Harrod's...

    Here the handout along with the template of what we need to complete. Thank you! Harrod's Sporting Goods Jim Harrod knew that service, above all, was important to his customers. Jim and Becky Harrod had opened their first store in Omaha, Nebraska in 1997. Harrod's carried a full line of sporting goods including everything from baseball bats and uniforms to fishing gear and hunting equipment. By the year 2015, there were twelve Harrod stores producing $5 million in total sales...

  • CASE 3.1 Eminent Domain SUSETTE KELO'S NONDESCRIPT, PINK CLAPBOARD Kil'I, MINK CLAPBOARD house sits above the...

    CASE 3.1 Eminent Domain SUSETTE KELO'S NONDESCRIPT, PINK CLAPBOARD Kil'I, MINK CLAPBOARD house sits above the Thames River in the Fort Trumbull area of New London, Connecticut. It's surrounded by vacant lots, where neighbors once lived. One by one, these neighbors have left, and their homes have been razed. Their property has been taken over by the City of New London, which has used its power of eminent domain to clear the land where dozens of homes once stood in...

  • Questions 3 and 5 Frozen Coke and Burger King and the Richmond Rigging 12 Case 8.17 president of Coca-Cola's Foodservice and Hospitality Division, was looking on sells fountain-dispensed soda...

    Questions 3 and 5 Frozen Coke and Burger King and the Richmond Rigging 12 Case 8.17 president of Coca-Cola's Foodservice and Hospitality Division, was looking on sells fountain-dispensed soda to restaurants, convenience marts fountain division, a division responsible for one-third of all of Coke's revenues , and Tom Moore, president of sales in the The fountain division fourn theaters. Sales were stagnant, and he knew from feedback from the salespeople that Pepsi ias moving aggressively in the area. In 1999,...

  • Please read case article, "Attention Kmart Shoppers? Into and out of Bankruptcy" and help me come...

    Please read case article, "Attention Kmart Shoppers? Into and out of Bankruptcy" and help me come up with a solution for the case as well as action steps to implement the solution! Thank you!! ATTENTION KMART SHOPPERS? Former Kmart CEO, Charles C. Conaway, failed in his 19-month effort to revive the iconic firm, resulting in the largest retailing bankruptcy filing in history on January 22, 2002 (Davies, et al., 2002). On March 11, 2002, bankrupt Kmart named James B. Adamson...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT