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

Well it was asked in my interview and I have no clues how to start with it.
All I can analyze is that I have to use Trees and have to use random generator for flipping coin problem.

Well it was asked in my interview and I have no clues how to start with it.

so i get the job if i do this and you dont??

sounds like you better learn it before you get a job in it.

I got my job on a simpler question; a bit-level reverser. Thankfully, I picked up on the pattern fast enough that I didn't look too foolish.
Anyway: I'm not sure I understand the initial question. When does this guy (who should wear glasses or goggles; dirty contacts are dangerous!) know he's in front of a pancake house? When he gets there? Or, are there two pancake places next to each other on the same side of the street, so only when he gets to the first, he's aware of the second pancake house (but not the first)?

The way the original post went, it's not obvious what you mean.

Why is Dani Web so agitated when people ask a question? This person didnt understand something they came across and decided to post here to better understand it. Stop assuming the worst of everyone who asks a question, please. The poster got his job, and now wants to go back and make sure he understands the other question he came across. Thats NOT a bad thing.

Why is Dani Web so agitated when people ask a question? This person didnt understand something they came across and decided to post here to better understand it.

Because based on the first post it is just another request to do his homework for him. He didn't ask for clarification. He asked for an answer.

Since we are not a homework service, and we get scores of these "do my work for me" questions a day, after 50000+ of these requests (in my case at least) we get very irritated at lazy people that can't be bothered to
1) ask and intelligent questions
2) try it first, show us what they did, then ask for help
3) and many other "I can't be bothered, you do it" type of posts.

This article has been dead for over six months. Start a new discussion instead.