Site icon i2tutorials

DAA- Probabilistic analysis

Probabilistic analysis

In general, probabilistic analysis is used to analyze the running time of an algorithm.In simple words, probabilistic analysis is the use of probability in the analysis of problems.

 

Sometimes, we can also use it to analyze quantities. One such example is the hiring cost in procedure Hire-Assistant.

 

Hiring Problem:

For example, you are using an employment agency to hire a new assistant for your company. The agency works in such a way that it sends you one candidate per day. You then interview the candidate after which you must immediately decide whether or not to hire that person. Also, if you hire that person, you must fire your current office assistant. Even if it is someone you have hired recently you must fire them before you hire a new assistant.

 

For this, let us consider the cost to interview as ci per candidate and the cost to hire the candidate is ch.

 

Also, there are a few requirements to be fulfilled which are:

 

Let us have a look at the pseudo code to the model.

 

Hire-Assistant (n) 
best <- 0 ;Candidate 0 is a least qualified candidate 
for i <- 1 to n 
     do interview candidate i 
         if candidate i is better than candidate best 
              then best <- i 
                  hire candidate i

 

Here are a few points to be considered for the Cost Model:

 

Best-Case Analysis for Hiring Problem

 

Worst-case Analysis for Hiring problem

 

Average-case Analysis for Hiring problem

 

Now, we want to know the expected cost of our hiring algorithm in terms of the number of times we hired an applicant.

 

What is Indicator Random Variable?

It is a powerful technique that is used for computing the expected value of a random variable. Also, it is a convenient method for converting between probabilities and also expectations. Indicator Random Variable takes only 2 values, which are 1 and 0.

Indicator Random Variable XA=I{A} for an event A of a sample space is defined as:

I{A} =  1 if A occurs
        0 if A does not occur

 

The expected value of an indicator Random Variable is associated with an event A is equal to the probability that A occurs.

 

Indicator RV – Example

Problem: Determine the expected number of heads in one toss.

XA= I{ coin coming up with heads}=1/2
Therefore, E[XA] = 1/2

 

This is all about probabilistic analysis, Hiring problem, and the Indicator random variable. Do check the next article on Disjoint sets.

 

Exit mobile version