Question: Algorithms: Gadget Testing A company wants to determine the highest floor of its n - story headquarters from which a gadget can fall without breaking,

Algorithms:
Gadget Testing A company wants to determine the highest floor of its n-story headquarters from which a gadget can fall without breaking, so theyll test this by dropping gadgets and seeing when they break. The company only has one gadget to test with, and if the gadget breaks, it cannot be repaired that is, by the time the gadget breaks, they better have the answer to your question.
(brute force) Design a \Theta (n)-time algorithm to solve this problem. Provide pseudocode or a precise description of your approach. Determine the worst-case efficiency of your algorithm as a function of n, the number of stories of the building.
(b)(optimization) Now, suppose that the company has two identical gadgets to experiment with (identical means that if gadget 1 could survive a fall from floor k, then so can gadget 2, and vice-versa). If one of the gadgets gets broken, it cannot be repaired, and the experiment will have to be completed with the remaining gadget. Use the 2nd gadget to improve on your algorithm from part (a). That is, design an algorithm that has efficiency better than \Theta (n).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!