Hi,

I have a problem in data structures I am stuck in this one .Please try to help me.

Question : A man Joe has a habbit of eating pancakes & driving

bikes.Once he went for outside by his bike,now he is EXACTLY IN THE

MIDDLE OF A ROAD his stomach is crying for pancakes and also his

contact lenses are full of dirt.Now HE CANNOT SEE A PANCAKE SHOP UNTILL HE REACH THE PANCAKE SHOP EXACTLY BEFIRE IT.

Now please provide me the algorithm/code for finding the pancake shop which is nearer to JOE & also tell me how can I calculate time and space complexity.

Note: Information given as if he goes to the right side it is

considered as 1unit,2unit....and son on and if he chooses left then

-1unit,-2unit...and so on.

II)Second part of the problem says that if Joe wants to flip a coin for

,in which direction(left or right) he has to move.

Then what happens to the code/algorithm.

left<---- ------>right

Example:-------------------------------------------------

Road (Joe)in the middle of the road.

--------------------------------------------------

Thanks