Question: Please provide a separate algorithm for the two parts below. Thanks You are facing a high wall that stretches infinitely in both directions. There is

Please provide a separate algorithm for the two parts below. Thanks

 Please provide a separate algorithm for the two parts below. Thanks

You are facing a high wall that stretches infinitely in both directions. There is a door in the wall, but you don't know how far away or in which direction. It is pitch dark, but you have a very dim lighted candle that will enable you to see the door when you are right next to it. Suppose n is the (unknown to you) number of steps between your initial position and the door. (a) Give a theta(n^2) algorithm that enables you to reach the door. (b) Give a theta (n) algorithm that enables you to reach the door. For both algorithms, the input is the high wall that stretches infinitely in both directions. For the output, you can simply return that the door is found

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 Databases Questions!