Hi!

Assume 5000 test cases of A,B,C,D.. and The probabilities are as
mentioned above.

Then If loop will fail for 75% of test cases and else will be
executed.. In that 75% test cases, only 75% test cases will satisfy
the inner if statement..

So 3/4 * 3/4  = 9/16.

9/16 * 5000 = 2812..

I guess that 'll do. :)

On Dec 14, 10:05 pm, Saurabh Koar <saurabhkoar...@gmail.com> wrote:
> @Sravan: Plz explain the logic..
>
> On 12/15/10, Sravan Akepati <sravan.akep...@gmail.com> wrote:
>
>
>
>
>
>
>
> > (1-0.25)* 0.75*5000 = 2812.5
>
> > On Wed, Dec 15, 2010 at 9:31 AM, ankit sablok <ankit4...@gmail.com> wrote:
>
> >> well i still believe that the calling of foo2 is independent plzzz suggest
> >> me the solution if i am wrong a detailed one thanx in advance
>
> >> On Wed, Dec 15, 2010 at 1:22 AM, Saurabh Koar
> >> <saurabhkoar...@gmail.com>wrote:
>
> >>> The function foo2 will be called iff the condition if(C<D) evaluates to
> >>> be
> >>> true.
> >>> Given that C<D turns out to be true 75% times.So why the call to foo2
> >>> will be independent??
> >>> I think it is only the simple math.Correct me if I am wrong..
>
> >>> On 12/15/10, ankit sablok <ankit4...@gmail.com> wrote:
> >>> > what i think is that the number of times foo2 being called is
> >>> > independent of the percentages given in the question it may be called
> >>> > 5000 times or 4999 times and continuinf in this fashion also none of
> >>> > the times as in every case there's 1/4 probability of A<B and 3/4 of
> >>> > C<D so as per me we cannot decide givn the percentage of success and
> >>> > failure any suggestions are always welcomed
>
> >>> > On Dec 15, 12:06 am, bittu <shashank7andr...@gmail.com> 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 algoge...@googlegroups.com.
> >>> > To unsubscribe from this group, send email to
> >>> > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups
> >>> >  .com>
> >>> .
> >>> > For more options, visit this group at
> >>> >http://groups.google.com/group/algogeeks?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Algorithm Geeks" group.
> >>> To post to this group, send email to algoge...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups
> >>>  .com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/algogeeks?hl=en.
>
> >> --
> >>  You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algoge...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups
> >>  .com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/algogeeks?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algoge...@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?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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?hl=en.

Reply via email to