944,033 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 4603
  • C RSS
Aug 8th, 2005
0

Data Structure Problem

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sandeepalankar is offline Offline
2 posts
since Aug 2005
Aug 8th, 2005
0

Re: Data Structure Problem

Sounds like a request for us to do your homework. What have you done so far?
Reputation Points: 13
Solved Threads: 0
Light Poster
Dante Shamest is offline Offline
46 posts
since Apr 2003
Aug 8th, 2005
0

Re: Data Structure Problem

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

Re: Data Structure Problem

Quote originally posted by sandeepalankar ...
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.
Reputation Points: 10
Solved Threads: 3
Junior Poster
jhdobbins is offline Offline
105 posts
since Apr 2005
Aug 8th, 2005
0

Re: Data Structure Problem

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.
Reputation Points: 22
Solved Threads: 5
Posting Whiz in Training
Drowzee is offline Offline
244 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: source code
Next Thread in C Forum Timeline: Need Help With Piglatin Program In C





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC