Problem 3 We have p houseplants in planters of various sizes $1, 52,..., Sp. The plants...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Problem 3 We have p houseplants in planters of various sizes $1, 52,..., Sp. The plants are getting too big and each plant has to be replanted to a larger planter than the one it currently has. The good news is that we have r extra planters of sizes t₁, t₂,..., tr. Is it possible to replant the plants, one at a time, always putting the plant to a larger currently empty planter? Let n = p+r. Design an O(n log n) algorithm which decides whether such replanting is possible. 2 For example, for p = 4 and r = 2 and planters $₁,..., 84 = 1, 4, 3, 2 and t₁, t2 = 5,1 we can first move the plant in the planter of size 4 to the empty planter of size 5, then move the plant in the planter of size 3 to the now-empty planter of size 4, then move the plant in the planter of size 2 to the now-empty planter of size 3, and finally move the plant in the planter of size 1 to the now-empty planter of size 2. (We will be left with two empty planters of size 1 each.) Thus, for the input, the answer is YES. On the other hand, for input p = 3 and r = 1 and planters 81, 82, 83 = 2, 2, 2 and t₁ = 3 the answer is NO. Problem 3 We have p houseplants in planters of various sizes $1, 52,..., Sp. The plants are getting too big and each plant has to be replanted to a larger planter than the one it currently has. The good news is that we have r extra planters of sizes t₁, t₂,..., tr. Is it possible to replant the plants, one at a time, always putting the plant to a larger currently empty planter? Let n = p+r. Design an O(n log n) algorithm which decides whether such replanting is possible. 2 For example, for p = 4 and r = 2 and planters $₁,..., 84 = 1, 4, 3, 2 and t₁, t2 = 5,1 we can first move the plant in the planter of size 4 to the empty planter of size 5, then move the plant in the planter of size 3 to the now-empty planter of size 4, then move the plant in the planter of size 2 to the now-empty planter of size 3, and finally move the plant in the planter of size 1 to the now-empty planter of size 2. (We will be left with two empty planters of size 1 each.) Thus, for the input, the answer is YES. On the other hand, for input p = 3 and r = 1 and planters 81, 82, 83 = 2, 2, 2 and t₁ = 3 the answer is NO.
Expert Answer:
Answer rating: 100% (QA)
Given p plants and r extra planters the problem is equivalent to finding the smallest size of plante... View the full answer
Related Book For
International Financial Reporting A Practical Guide
ISBN: 978-1292200743
6th edition
Authors: Alan Melville
Posted Date:
Students also viewed these human resource management questions
-
If you were advising a firm on how to proceed in this area, what steps and priorities would you recommend?
-
If you were advising the founders of a new Internet-based business, what would you tell them about the benefits of using a conduit organizational form to operate their business?
-
If you were advising a North Dakota company about its selection process, would you advise it to relax its selection criteria during the oil boom? Why or why not?
-
A monatomic ideal gas that is initially at a pressure of 1.50 X 105 Pa and has a volume of 0.0800 m' is compressed adiabatically to a volume of 0.0400 m3. (a) What is the final pressure? (b) How much...
-
The following data are the population of ages of students who have recently purchased a sports video game: a. Compute the population variance. b. Compute the population standard deviation. 50701...
-
Write a computer code to perform the gradient method of steepest ascent algorithm using the Golden Section Search Method (presented in Section 7.6) to maximize the function: to obtain =k at each step...
-
Determine if pretrial conferences are required or authorized in California. Are there special rules in California that must be followed?
-
Marriott International, Inc., and Wyndham Worldwide Corporation are two major owners and managers of lodging and resort properties in the United States. Abstracted income statement information for...
-
Organizations practice yield management without all the publicity that airlines receive. Discuss how hotels, restaurants, and universities practice revenue management. Do their revenue management...
-
A national catalog and Internet retailer has three warehouses and three major distribution centers located around the country. Normally, items are shipped directly from the warehouses to the...
-
What is the pressure in N/m at a point 2 m below the free surface of static water? Assuming atmospheric pressure as 101325 N/m
-
Flax Corp. uses the direct method to prepare its statement of cash flows. Flax's trial balances at December 31 for Year 6 and Year 5 show the following information: Account Cash Accounts Receivable...
-
A borrower takes out a 30-year fixed rate mortgage for $310,000 and a rate of 4.1%. Five years later, rates have fallen and the borrower can now obtain a new 30-year mortgage, refinancing the...
-
Here are the returns on two stocks: Digital Cheese Executive Fruit January +18 +8 February -4 +1 March +6 +5 April +8 +16 may -5 +2 June +4 +6 July -3 -4 August -9 -3 A-1) Calculate the variance...
-
The Blast company prices GC game consoles at $450 per unit. GameCore sells the GC's at $675. Annual demand at this retail price turns out to be 250,000 units. GameCore incurs ordering, receiving, and...
-
What might taking a stance against his CEO mean for Ankit's career at IvoryTower and beyond? (can from case or personal idea) 60-100 words Ankits deputy Case Study Should We Embrace Crypto? by...
-
How do I make the submit, modify, and delete buttons work? I did the layout but need help in making action events. I also need help in making this GUI app using random access file. How do I do that? ...
-
A fuel pump sends gasoline from a car's fuel tank to the engine at a rate of 5.88 10-2 kg/s. The density of the gasoline is 735 kg/m3, and the radius of the fuel line is 3.18 10-3 m. What is the...
-
A company adopts international standards for the first time when preparing its financial statements for the year to 30 June 2018. These financial statements show comparative figures for the previous...
-
Chilwell Ltd prepares financial statements to 31 October each year. The company's trial balance at 31 October 2017 is as follows: The following information is also available: 1. Land is...
-
(a) Sparkling Pictures plc is a company which specialises in video production. The company is preparing its financial statements for the financial year ended 30 April 2018. During the financial year...
-
Typically most large scale commercial developments require an environmental impact assessment to be undertaken as part of the planning process. While more a regulatory requirement, such an assessment...
-
Use the data presented in 12.13. The probability of the monthly contribution from the new product exceeding 13 500 is: (a) 24.5% (b) 30.5% (c) 63.0% (d) 92.5% 12.13: A company expects to sell 1000...
-
Most businesses will try to minimize risk through a combination of risk assessment, risk management and, where possible, transfer the risk to another party. For businesses, risks like theft, fire...
Study smarter with the SolutionInn App