I think, we must give answers in the range..

See, what happens if the

Test cases which doesn't satisfy (A<B) can be the test cases which
satisfy the condition (C<D)

In that scenario,

!(A<B)  and  (C<D) co-occurs,  Ouput will be 3/4 *1  * 5000 = 3750..

o.w,  Worst case , 3/4 * 2/3 * 5000 = 2500 ..

Range - 2500 < x < 3750



Correct me if i am wrong.. :)


On Dec 14, 10:37 pm, Ankur Khurana <[email protected]> wrote:
> i think sravan is right. we go to C<D condition after A<B have failed.
> For that to happen, we have prob. of .75 . now the probability of C<D
> is .75 . so total probability is .75 * .75 as both are mutualy
> exclusive events. so total no. foo2 is called is 2812.5 .
>
> On Wed, Dec 15, 2010 at 11:55 AM, Ankur Murarka
>
>
>
>
>
>
>
> <[email protected]> wrote:
> > @Sravan
> > There seems to be a little problem in your solution. Your are probably
> > assuming that 75% of C is less than D after the condition that A is greater
> > than B while thats not the case according to the question.
>
> > My Solution -
> > Out of 5000 cases, A>B in 3750 of them and C<D in 3750 of them again. Thus,
> > foo2 should run atleast 2500 times and not more than 3750 times depending on
> > the input combinations.
>
> > On Wed, Dec 15, 2010 at 11:35 AM, Saurabh Koar <[email protected]>
> > wrote:
>
> >> @Sravan: Plz explain the logic..
>
> >> On 12/15/10, Sravan Akepati <[email protected]> wrote:
> >> > (1-0.25)* 0.75*5000 = 2812.5
>
> >> > On Wed, Dec 15, 2010 at 9:31 AM, ankit sablok <[email protected]>
> >> > 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
> >> >> <[email protected]>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 <[email protected]> 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 <[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%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 [email protected].
> >> >>> To unsubscribe from this group, send email to
>
> >> >>> [email protected]<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 [email protected].
> >> >> To unsubscribe from this group, send email to
>
> >> >> [email protected]<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 [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.
>
> >> --
> >> 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.
>
> > --
> > 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.

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