[algogeeks] Re: Probability Puzzle

2011-08-08 Thread Maddy
I think the answer is 17/80, because
as you say the 5 trials are independent.. but
the fact that a head turns up in all the 5 trials, give some
information about our original probability of choosing the coins.

in case we had obtained a tail in the first trial, we can be sure its
the fair coin, and so the consecutive trials would become
independent..

but since that is not the case, every head is going to increase the
chance of choosing the biased coin(initially), and hence affect the
probability of the next head..

before the first trial probability of landing a head is 3/5, but once
u see the first head, the probability of landing a head on the second
trial changes to 4/5*1/4+1/5, and so on..that is, there is a higher
probability that we chose a biased coin, rather than the fair coin.

hope its clear..

On Aug 7, 11:36 pm, sumit gaur sumitgau...@gmail.com wrote:
 (3/5)

 On Aug 7, 10:34 pm, Algo Lover algolear...@gmail.com wrote:







  A bag contains 5 coins. Four of them are fair and one has heads on
  both sides. You randomly pulled one coin from the bag and tossed it 5
  times, heads turned up all five times. What is the probability that
  you toss next time, heads turns up. (All this time you don't know you
  were tossing a fair coin or not).

-- 
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?hl=en.



[algogeeks] Re: Testcases

2011-07-29 Thread Maddy
If the three sides are a,b,c

1. sum of length of any two sides of a triangle, always exceeds the
third side. So, this can be taken as the first test case, to see if
a,b,c form a triangle.
2.if any of the two sides a,b,c are equal- its isoceles triangle
3.in an obtuse triangle, sum of square of 2 sides should be less than
the third side
4. if a, b and c are all different, then it is a scalene triangle.


for the duster case, I think this might help
http://www.geekinterview.com/question_details/29384


On Jul 29, 2:36 am, Umer Farooq the.um...@gmail.com wrote:
 Is that from a phone interview of MS? :-|

 On Fri, Jul 29, 2011 at 2:32 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:









  Hey everyone , pls tell me how testcases of following:

  1. 3 sides of a triangle are taken, output whether its obstuse,
  scalene,isosceles..?
  2. testcases of a duster...

  I know nothing about testcases, so pls reply accordingly..!!

  --
  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?hl=en.

 --
 Umer

-- 
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?hl=en.



[algogeeks] Dynamic programming help

2008-12-09 Thread maddy

can anyone help how to approach to this DP problem?

Let fi(x) = i*(1+log x). Describe a dynamic programming
algorithm to input 2 integers x and m and determine how to
break x into m integers x1, x2, ..., xm such that
f1(x1)+f2(x2)+...+fm(xm) is the largest among all possible ways of
breaking x into m integers. Note that x≥m and xi≥1 for all
1≤i≤m

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---