Latest News

Thursday, 19 April 2012

Parachutist Dilemma - a parallel programming problem

Here is a little mental problem solving exercise for you to try to do in 30 seconds; that was the time I was allowed. So I had a telephone interview from a company today and this guy asked me this question utilizing a parrallel programming algorithm. Here are the details:

Two parachutist (A and B: A is in front of B) land on single line; one behind the other. Their parachutes also lands behind them respectively. 
We have a set of instructions which are as follow (all instructions are executed, meaning A and B will executed instructions at the same time).
  1. move forward 1 step
  2. move back 1 step
  3. if standing on a parachute go to (1 | 2)

Question:

We need our parachutist to somehow meet each other, what are the sets of instructions that can make that happen?

Please try to answer before reading my answer below

My answer:

  1. execute 2
  2. execute 3
Explanation:

  • When both parachutist move back 1 step, they will both be on their parachutes
    • when parachutist A stands on his parachute, he will move back 1 step therefore go to 1
    • when parachutist B lands on his parachute, he will move forward 1 step 
Therefore our two parachutist will meet in B original position.

NB I had to change the original questions as the interviewer explanations led to the parachutist to never meet.
  • Blogger Comments
  • Facebook Comments

5 comments :

  1. I have seen fantastic blogs and I have seen not so fantastic blogs. This blog is very informative in many ways and certainloy ranks in the former category. Really appreciate the information your providing use avid readers!
    http://celabright.com/

    ReplyDelete
  2. Both we can better start with forex and after that nadex binary options, learn and only then trade binary options, but i can tell you that before you can use any strategy you have to understand yourself first, how is your mind work, without it you will continue the up and down profit/loss, feeling pressure/calm.
    More information please visit our web site :http://www.automatedbinaryoptions.co/?p=180

    ReplyDelete
  3. You made some clear points there. I looked on the internet for the subject matter and found most persons will consent with your blog.
    amazon best sellers list uk

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete

Item Reviewed: Parachutist Dilemma - a parallel programming problem Description: Rating: 5 Reviewed By: Unknown
Scroll to Top