Labels

Wednesday, August 10, 2011

Fox in the hole

There is a fox and 7 holes . The fox lives in one of the hole everyday and during night she moves to a hole either left or right. The farmer comes in the morning and can check any one hole, What strategy should be applied by the farmer to catch the fox in minimum number of days.

solution == >

important thing to notice here is that , on any day fox will be either on an even numbered hole {2,4,6} or odd numbered hole{1,3,5,7}

S1 = {2,4,6}
S2 = {1,3,5,7}

let on morning one, she is in set S1

than we have 3 possible cases

2, {1,3}, {2,4}, {1,3,5}, {2,4,6}

4, {3,5}, {2,4,6}, {1,3,5,7}, {2,4,6}

6, {5,7}, {4,6}, {3,5,7}, {2,4,6}

this are the only possible cases for 5 mornings

now observe this sequence for farmer

2,3,4,5,6

case 1: caught on first morning
case 2: caught on at most fifth morning
case 3: caught on at most fifth morning

proof that this will always work


suppose 2 fails , means she should be in either 4 or 6 , so she will move to either 3,5,7 . if 3 fails means she was in 6 so she moved to either 5 or 7 . so next will be either 4 or 6 . if 4 fails than she was moved to 7 so next she will move to 6 and will eventually get caught.


the above logic is to be processed in mind to be able to solve this question in time :-)


if our base case is wrong, means she is on set S2 on first morning
than also she will be surely in set S1 on 6th morning . so

the complete sequence can be

2,3,4,5,6,2,3,4,5,6

means 10 days will be enough to catch the fox.

but why one should think of the given sequence?

conclusion
their exist 4 sequences in all .
2,3,4,5,6,2,3,4,5,6
6,5,4,3,2,6,5,4,3,2
2,3,4,5,6,6,5,4,3,2
6,5,4,3,2,2,3,4,5,6

note:
divide things into sets when choices are there
use hit and trial after arriving at some reasonable point .

No comments:

Post a Comment