Various praise/comments/rants about Troy, RPI, PhDs, Macs, and life in general.

Tuesday, November 18, 2008

Algorithm question...

You are in a mailbox. Space is limited. You decide to reward one of the recipients (with completely fair probability) by attaching a $100 bill to their letter and delivering it personally. There is only enough space in the mailbox to accumulate x letters, where x < n, the number of letters you will receive. How do you choose which letter to which you should attach the money?

Some assumptions:

  • You do not have enough space in the mailbox to retain all n letters and then choose, which would have the desired 1/n probability.
  • You have a pen and some scratch paper and you are able to keep track of the current number of letters up to and including n.


I heard this problem from Sean and Rick. I'll post the answer in a day or so.