actually it depends upon whether condition (A<B) and condition (C<D) can
occur simultaneously or these conditions are mutually exclusive.

If these two conditions can't occur simultaneously then foo2() will be
called 5000 * 75/100 = 3750
but if they can occur simultaneously then call to foo2() will be less than
3750 depending upon the overlapping of the both conditions.

--
Ashish Gupta


On Thu, Sep 17, 2009 at 3:32 PM, ankur aggarwal <ankur.mast....@gmail.com>wrote:

>
> 5. 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
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to