You are given m identical eggs and an n story building. You need to figure out...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You are given m identical eggs and an n story building. You need to figure out the highest floor l {0, 1, 2,... n} that you can drop an egg from without breaking it. Each egg will never break when dropped from floor or lower, and always breaks if dropped from floor l+1 or higher. ( = 0 means the egg always breaks). Once an egg breaks, you cannot use it any more. However, if an egg does not break, you can reuse it. Let f(n, m) be the minimum number of egg drops that are needed to find l (regardless of the value of l). (a) Find f(1,m), ƒf(0, m), f(n,1), and f(n,0). Briefly explain your answers. (b) Consider dropping an egg at floor x when there are n floors and m eggs left. Then, it either breaks, or doesn't break. In either scenario, determine the minimum remaining number of egg drops that are needed to find in terms of f(·,·), n, m, and/or x. (c) Find a recurrence relation for f(n,m). Hint: whenever you drop an egg, call whichever of the egg breaking/not breaking leads to more drops the "worst-case event". Since we need to find l regardless of its value, you should assume the worst-case event always happens. (d) If we want to use dynamic programming to compute f(n, m) given n and m, in what order do we solve the subproblems? (e) Based on your responses to previous parts, analyze the runtime complexity of your algorithm. (f) Analyze the pace complexity of your DP algorithm. (g) (Extra Credit) Is it possible to modify your algorithm above to use less space? If so, describe your modification and re-analyze the space complexity. If not, briefly justify. DP You are given m identical eggs and an n story building. You need to figure out the highest floor l {0, 1, 2,... n} that you can drop an egg from without breaking it. Each egg will never break when dropped from floor or lower, and always breaks if dropped from floor l+1 or higher. ( = 0 means the egg always breaks). Once an egg breaks, you cannot use it any more. However, if an egg does not break, you can reuse it. Let f(n, m) be the minimum number of egg drops that are needed to find l (regardless of the value of l). (a) Find f(1,m), ƒf(0, m), f(n,1), and f(n,0). Briefly explain your answers. (b) Consider dropping an egg at floor x when there are n floors and m eggs left. Then, it either breaks, or doesn't break. In either scenario, determine the minimum remaining number of egg drops that are needed to find in terms of f(·,·), n, m, and/or x. (c) Find a recurrence relation for f(n,m). Hint: whenever you drop an egg, call whichever of the egg breaking/not breaking leads to more drops the "worst-case event". Since we need to find l regardless of its value, you should assume the worst-case event always happens. (d) If we want to use dynamic programming to compute f(n, m) given n and m, in what order do we solve the subproblems? (e) Based on your responses to previous parts, analyze the runtime complexity of your algorithm. (f) Analyze the pace complexity of your DP algorithm. (g) (Extra Credit) Is it possible to modify your algorithm above to use less space? If so, describe your modification and re-analyze the space complexity. If not, briefly justify. DP
Expert Answer:
Answer rating: 100% (QA)
a Here are the values of fn m for the given cases f1 m You have only one egg In the worst case youll ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
2) Let 2 = -- 0 -- 0 -- 0 1 = W2 2 " ] 1 and let W = span{W1, W2} be the subspace of R with the standard inner product. Write the vector v as w+u with w W and u W. Find the distance between v and W....
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Now that you have background on ethics and a set of skills for evaluating ethical issues, the application to real-life dilemmas seems fairly straightforward. However, there is one additional aspect...
-
Explain why a safety net can save the life of a circus performer.
-
What is the y-intercept of a line? How do you find the y-intercept from an equation of a line?
-
The following unadjusted trial balance is prepared at fiscal year-end for Foster Products Company. Rent expense and salaries expense are equally divided between selling activities and the general and...
-
True or False. The Rayleigh-Ritz method assumes that the solution is a series of functions that satisfy the boundary conditions of the problem.
-
You have been approached about doing a consulting job for Choi Hung Company, which is based in southern China. Choi Hung reports its financial results using International Financial Reporting...
-
Which distribution option do you feel gives PAC the best opportunity for future success? Compare and contrast the three options from the perspective of cost. which one do you believe will provide the...
-
Based on the two tables and the attributes below, write SQL commands for each question to retrieve the data from the database. tblSales InvoiceNumber InvoiceDate CustomerNumber Sales OrderNumber...
-
Express 55.3 J of heat (or energy) in units of calories. * 0.76 cal O 231.4 cal 0.0132 cal O 13.2 cal One is defined as the heat needed to raise 1 lb of water by 1 Fo. * BTU O J/g Cal O J
-
An equities analyst is studying the pharmaceutical industry and would like your help in exploring and understanding the financial data collected by her firm. Her main objective is to understand the...
-
Assuming that machine learning techniques are to be used in the following cases, identify whether the task required is supervised or unsupervised learning. a. Deciding whether to issue aloan to an...
-
Personal Loan Acceptance. Universal Bank is a relatively young bank growing rapidly in terms of overall customer acquisition. The majority of these customers are liability customers with varying...
-
The city of Lora issued $5,000,000 of general government, general obligation, 8%, 20-year bonds at 103 on April 1, 20X7, to finance a major general government capital project. Interest is payable...
-
In fitting a model to classify prospects as purchasers or nonpurchasers, a certain company drew the training data from internal data that include demographic and purchase information. Future data to...
-
Complete the 1040EZ using the following information. Michal J. Wilson, single, who lives at 12 East Street, Glendale, South Carolina, 32991, and has a Social Security number of 000-00-0000, filed his...
-
The text defined intrinsic value as the value of an asset given a hypothetically complete understanding of the assets investment characteristics. Discuss why hypothetically is included in the...
-
The CEO of Fresh Snacks Corp. is concerned about the amount of resources currently spent on customer warranty claims. Each box of snacks is printed with the following logo: Satisfaction guaranteed or...
-
Which of the following purchases would be considered capital investments? Purchase Item a. The replacement of the engine on one of the companys aircraft is $ 190,000 (this will not increase the...
-
Abbott Work Wear, Inc., supplies uniforms for a variety of businesses. Greg Michaels is a new intern in the Accounting Department at Abbott. To expand sales, the company is considering paying...
-
Obtain the S\&P 500 Index daily closes for the period from January 1987 to December 2017 and compute the log returns. These are the data shown in Figure 1.30. Fit an MA(2) model to the returns....
-
Obtain the closing prices of MSFT and the S\&P 500 Index for the period January 1, 2017, through December 31, 2017, and compute the daily log returns for this period. (a) Compute and plot the ACFs of...
-
Let \[ P_{t}=P_{0} \exp \left(r_{t}+\cdots+r_{1} ight) \] where the \(r_{i}\) are distributed iid as \(\mathrm{N}\left(\mu, \sigma^{2} ight)\). Show that \(P_{t}\) is distributed as lognormal with...
Study smarter with the SolutionInn App