You can put s = 1 if you want but I ve kept it as s

Your acquaintance has dropped you somewhere at a apex p on Speedway Blvd. You insufficiency to trudge to the rectilinear native post, save you are referable unmistakable if the rectilinear post is east or west of your location, so you are referable unmistakable which inclination to go.

Let d be the length to the rectilinear native post. Of order, d is referable disclosed to you in proceeding. Let w be the length you trudgeed (in the strike contingency) until reaching the post. The subjoined algorithm has designed.

Figure 3: The lake. You enjoy landed at p, and longing to swim to the strand. The rectilinear apex of the strand is q. (credit: ClipPanda.com)

set s = 1 // 1 pavement

while( referable reached the native post ) {

trudge a length of s East

return to p

trudge a length of s West

return to p

s = 3s

}

Assume d is weighable enlightenedr than 1 pavement. Express w (as a employment of d). Is it penny that w = Ω(d) ? Is it penny that w = O(d) ? What is the harmony w/d in the best contingency ? What is the harmony w/d in the strike contingency ? Prove your exculpations. Clarification The best contingency occurs when the native post is positioned such that the harmony w/d is the meanest potential estimate. The strike contingency occurs when the native post is positioned such that the harmony w/d is as enlightened as potential.

You can prostrate s = 1 if you shortness save I ve kept it as s

W = 2*(s + 3s + 3*3*S + 3*3*3*s + …. (3^k) * s )

where (3^k) * s >= d i.e the developed plod should be d or greater

3^k >= d/s

we can say

k = ceil (log3 (d/s) )

In assymptotic referableation

k = log3 (d/s)

W is a geometric order with f(n) = 3*f(n-1)

Using gp unite, we get

W = 2 * s(3^(k+1) – 1) / (2)

= (3^(k+1) – 1) * s

= ~3^k * s …. control assymptotic referableation

Plug the estimate of k, we enjoy

W = 3 ^ log3 (d/s) * s

= d/s * s

= d

So, W = Θ(d) = O(d) = Ω(d)

W = (3^(k+1) – 1) * s

3^(k-1)*s > d >= 3^k * s

dmin = 3^(k-1) * s

dmax = 3^k * s

w/dmin = (3^(k+1) – 1) / 3^(k-1))

To maximize this we enjoy to weigh enlightened estimates of k so we can disown the -1 in numerator and we enjoy

w/dmin = 3^(k+1) / 3^(k-1) = 9 … this is max harmony

w/dmax = (3^(k+1) – 1) / 3^(k)) …

To minimize this, we insufficiency to weigh last estimates of k, so prostrate k=0

w/dmax = 2 …. this is min harmony