Assume the existence of two type of tables, where the shorter one is of length X...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Assume the existence of two type of tables, where the shorter one is of length X and the longer on is of length Y. A combination of these two types of tables are aligned to fill a given distance D. Using as few tables as possible, find the optimum combination to keep the remaining empty distance is as small as possible. [note: the first priority is to minimize the empty distance, and the second priority is to minimize the number of used tables] X" D Examples: Input: X 3, Y = 5 , D = 24 The optimum combination is: TX = 3, TY = 3, RD = 0 It means: three tables of size X (TX), three tables of size Y (TY), and remaining distance (RD) is 0. 3*3+3 5 = 24 So empty distance = 24 - 24 0 Input: X = 3, Y = 9, D = 29 Output: TX =0, TY = 3, RD = 2 It means: zero tables of size X (TX), three tables of size Y (TY), and remaining distance (RD) is 2. 0* 3+3*9 = 27 So empty distance = 29 - 27 = 2 a) Design an algorithm (pseudocode) to solve the above problem (2 marks), b) Implement your solution using Python (2 marks) Assume the existence of two type of tables, where the shorter one is of length X and the longer on is of length Y. A combination of these two types of tables are aligned to fill a given distance D. Using as few tables as possible, find the optimum combination to keep the remaining empty distance is as small as possible. [note: the first priority is to minimize the empty distance, and the second priority is to minimize the number of used tables] X" D Examples: Input: X 3, Y = 5 , D = 24 The optimum combination is: TX = 3, TY = 3, RD = 0 It means: three tables of size X (TX), three tables of size Y (TY), and remaining distance (RD) is 0. 3*3+3 5 = 24 So empty distance = 24 - 24 0 Input: X = 3, Y = 9, D = 29 Output: TX =0, TY = 3, RD = 2 It means: zero tables of size X (TX), three tables of size Y (TY), and remaining distance (RD) is 2. 0* 3+3*9 = 27 So empty distance = 29 - 27 = 2 a) Design an algorithm (pseudocode) to solve the above problem (2 marks), b) Implement your solution using Python (2 marks)
Expert Answer:
Answer rating: 100% (QA)
Here is the code this is a Dynamic Programming problem x intinputx y intinput... View the full answer
Related Book For
Principles of Auditing and Other Assurance Services
ISBN: 978-0078025617
19th edition
Authors: Ray Whittington, Kurt Pany
Posted Date:
Students also viewed these operating system questions
-
For the purposes of this problem, assume the existence of five types of auditors: CPA, GAO, IRS, bank examiner, and internal auditor. Also assume that the work of these various auditors can be...
-
A small block slides at a speed d v = 3 m/s on a horizontal surface at a height h = 1 m above the ground. Determine (a) The angle at which it will leave the cylindrical surface BCD, (b) The distance...
-
Three point charges are aligned along the x -axis as shown in Figure. Find the electric field at the position x = + 2.0 m, y =0. 0.50 m- 0.80 m- - 4.0 nC 5.0 nC 3.0 nC
-
What is meant by budgetary control?
-
a. Determine the levels of lc and VCE for the network of Fig. 4.121. b. Change β to 135 (50% increase), and calculate the new levels of IC and VCE. c. Determine the magnitude of the...
-
The local bakery bakes more than a thousand 1-pound loaves of bread daily, and the weights of these loaves vary. The mean weight is 1 lb and 1 oz, or 482 grams.Assume that the standard deviation of...
-
Show that for the Ho-Lee model the (risk-neutral) standard deviation of the one-period rate is exactly \(b_{k} / 2\).
-
1. East Coast Yachts uses a small percentage of preferred stock as a source of financing. In calculating the ratios for the company, should preferred stock be included as part of the companys total...
-
Include a list of the principals involved in your business a mobile mechanic with a brief overview of how their particular skills will serve the business. Include accomplishments that relate to the...
-
The links of the chain are made steel that has a working stress of 300 MPa in tension. If the chain is to support the force P = 45 kN, determine the smallest safe diameter d of the links. P
-
Surprisel Jamie Lee and Ross were stunned to find that their family of two has grown to a family of fivel They were expecting twins, but when the babies were born, they discovered that they were...
-
Your grocery store most likely purchases Oreos and other Nabisco products from a a. wholesaler. b. retailer. c. agents/broker. d. distributor.
-
For what months are the futures contracts available?
-
The product itself can be considered part of the promotional mix because samples of it can be given away to demonstrate its features. True or False
-
QR codes, text messages, and apps are part of what kind of promotional strategy? a. Viral promotions b. E-commerce c. Mobile marketing d. Social promoting
-
What kind of impact do you think one company switching to less environmentally damaging practices could have on the general atmosphere of the shipping world?
-
A composite material of silicon carbide-filled magnesium is designed with a mixture of 50% of silicon carbide by volume. Given the densities of the consituent materials below: Density (gcm3) Young's...
-
Evaluate each logarithm to four decimal places. log 0.257
-
What are the major functions of audit working papers?
-
What landmark case was embraced by the court in the case of Credit Alliance Corp. v. Arthur Andersen & Co.? Identify the two factors that the court stated must be proved for the auditors to be held...
-
You have been assigned to the audit of Processing Solutions, Inc., a privately held corporation that develops and sells computer systems. The systems are sold under one- to five-year contracts that...
-
What is the difference between leading zeros and trailing zeros? Which ones are considered significant digits?
-
Explain the difference between number of digits, number of decimal places, and number of significant digits in a numerical value. Illustrate your explanation using the number 0.03720 .
-
What is the simplest way to convert a quantity given in one unit to the same quantity given in a different unit?
Study smarter with the SolutionInn App