whoops, read the problem wrong. change all references from day 9 to day 10.
The idea of the 1st part of my algorithm is to take advantage of the fact that you know that only one person will see the card on each day. If the a kid comes back on the 3rd day, you don't get much benefit from the plan. Then that kid knows that can really only count on 2 kids (him and another) and has to go through the 2nd part of the algorithm for 8 other kids. BUT if a kid doesn't get repeated until day 5 or so, then he's already got 4 kids counted (including himself) and needs to go through the 2nd part for 6 of the kids.
To clarify with an example: Let's call them kids 1-10.
1st day. Kid 1 (black)
D2: K2 (black)
D3: K3 (black)
D4: K2 (white, knows that 3 kids, including himself, have entered)
D5: K4 (white)
D6: K1 (white)
D7: K5 (white)
D8: K5 (white)
D9: K2 (white)
D10: K4 (black, so that next time K2 enters, he knows that at least 4 kids have entered. It was necessary to establish a day when you switch to the 2nd algorithm, because if you start immediately after Day 4, the card gets flipped to black on Day 5 by K4, and on Day 6, K1 might think he's the 1st person to enter twice and is therefore the information gatherer.)
From here on out, you continue with the 2nd part of the algorithm. You could solve the problem with JUST the 2nd part of the algorithm, but, on average, you get a more efficient answer by adding the 1st part. Still trying to think of other solutions.
EDIT: also, like I said, the 1st part of the algorithm takes advantage of the fact that you know only 1 kid is entering per day, so you can count kids entering by counting the days. If the time interval between which kids are entering is unknown, then that 1st part of the algorithm is useless. ALSO: it might be more efficient, on average, to use a cutoff day other than Day 10. Using Day 10 as the cutoff allows the possibility of getting out of camp as early as Day 10, but if you use something like Day 5 or Day 6 it might be more efficient on average, even though you would never get out after 10 days. When using Day 5 as the cutoff, then if the kid entering on Day 5 sees that the card is black, he flips it to white even if it's his first time entering and becomes the information gatherer (and knows that 5 kids have entered the room as of Day 5 if it's his 1st time, or that 4 kids have entered if it's his 2nd time).
2nd EDIT: I guess this also assumes that all the kids know that the 1st day that a kid will enter the room is June 1st, or something like that, so that they can count days.
__________________
oh baby oh baby, i like gravy.
Last edited by rsl12; 03-22-2004 at 01:22 PM..
|