Find a perfect strategy algorithm for finding another person in a shop

94 Views Asked by At

'There is a row of 9 consecutive shops, John will visit a shop for 14 consecutive days. John moves venues daily to a shop directly left or directly right (end of row means forced move). John moves completely randomly. I want to find John in a shop on one of the days, I am not aware of the shops John has visited. Is there a strategy that assures that I will meet John in a shop in the 14 days?'

I think there is no strategy as John could just visit two shops for the duration of the 14 days and I don't think you can find John if he chooses to only remain in two shops.

What do you think?

1

There are 1 best solutions below

3
On BEST ANSWER

Number the shops $1-9$ and then visit the shops in the order: $2,3,4,5,6,7,8,8,7,6,5,4,3,2$.

  • During the first half of the walk ($2-8$), if the first day John was in an even shop, it stays in the shop of the same parity as you all along, and because that prevents him from "skipping" over you, you will catch him.

  • Otherwise, he is in the shop with the opposite parity than you on the first day, and up to $7$th day, but on the $8$th day he must be in the shop with the same parity as you (as on the 8th day you switch parity), and so you will catch him on the way back.

A similar problem was recently posted on Math.SE: Find a bug under 6 tiles.