# bin and ball

### Lemma

 Consider a process that throws balls uniformly at random into b bins and let C be a subset of these bins. If the process throws balls, then the probability that each bin in C has at least one ball is at most if , where is some constant strictly less than 1. If , then the probability is at most .

Comment: conpon analysis + chernoff bound

### Lemma

 Consider a process that throws t balls into b bins uniformly at random. if , then the probability that there are at most occupied bins is at most .

### Lemma

 Consider a process that throws balls uniformly at random into b bins and let C be a subset of these bins. If the process throws q balls, then the probability that at least of the bins in have at least one ball is at most if ; and at most if ## Reference

 Co-Location-Resistant Clouds, by Yossi Azar et al. in CCSW 2014

# Online Hiring Problem

## Problem

If there are n candidates, and we do not want to interview all candidates to find the best one. We also do not wish to hire and fire as we find better and better candidates.

Instead, we are willing to settle for a candidate who is close to the best, in exchange of hiring exactly once.

For each interview we must either immediately offer the position to the applicant or immediately reject the applicant.

What is the trade-off between minimizing the amount of interviewing and maximizing the quality of the candidate hired?

## Analysis

We analysis in the following to determine the best value of k that maximize the probability we hire the best candidate. In the analysis, we assume the index starts with 1 (rather than 0 as shown in the code).

Let be the event that the best candidate is the -th candidate.
Let be the event that none of the candidate in position to is chosen.
Let be the event that we hire the best candidate when the best candidate is in the -th position.

We have since and are independent events.    Setting this derivative equal to 0, we see that we maximize the probability, i.e., when , we have the probability at least .

Reference
 Introduction to Algorithms, CLSR