954,480 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Data Structure Problem

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

sandeepalankar
Newbie Poster
2 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

Sounds like a request for us to do your homework . What have you done so far?

Dante Shamest
Light Poster
46 posts since Apr 2003
Reputation Points: 13
Solved Threads: 0
 

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.

sandeepalankar
Newbie Poster
2 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 
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.

jhdobbins
Junior Poster
105 posts since Apr 2005
Reputation Points: 10
Solved Threads: 3
 

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.

Drowzee
Posting Whiz in Training
245 posts since Jul 2005
Reputation Points: 22
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You