If we rewrite question in terms of Probability, call to foo2() depends on
two events:
1. (E1) A > B, probablity 75%.
2. (E2) C < D, again probability 75%.

Probability (E) = Prob(E1) * Prob(E2) = 75/100 * 75/100 * 5000 = 2812.50
times.

Correct me if wrong.
- Dinesh Bansal

On Wed, Dec 15, 2010 at 12:36 AM, bittu <[email protected]> wrote:

>
> void foo1()
> {
>  if(A<B)
>    Then {_/*.... */}
>  else
>   if(C<D)
>     then foo2()
> }
>
> How many time foo2() would get called given
> A<B 25% of the times and C<D 75% of the times and foo1() is called
> 5000 times
>
> although i had diff...solution..but i wants to confirm wid others..so
> hav a look
>
> Regards
> Shashank Mani
> BIT Mesra
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Dinesh Bansal
The Law of Win says, "Let's not do it your way or my way; let's do it the
best way."

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to