Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your friend has dropped you somewhere at a point p on Speedway Blvd. You need to walk to the nearest bus station, but you are

Your friend has dropped you somewhere at a point p on Speedway Blvd. You need to walk to the nearest bus station, but you are not sure if the nearest station is east or west of your location, so you are not sure which direction to go.

Let d be the distance to the nearest bus station. Of course, d is not known to you in advance. Let w be the distance you walked (in the worst case) until reaching the station.

The following algorithm has proposed

image text in transcribed

Figure 3: The lake. You have landed at p, and wish to swim to the shore. The nearest point of the shore is q. (credit: ClipPanda.com)

set s = 1 // 1 foot

while( not reached the bus station ) {

walk a distance of s East return to p walk a distance of s West return to p s = s + 1

}

Assume d is much larger than 1 foot. Express w (as a function of d). Is it true that w = (d) ? Is it true that w = O(d) ? What is the ratio w/d in the best case ? What is the ratio w/d in the worst case ? Prove your answers.

Clarification The best case occurs when the bus station is positioned such that the ratio w/d is the smallest possible value. The worst case occurs when the bus station is positioned such that the ratio w/d is as large as possible.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions