else condition wud be called 75% times. of that 75% times cwrote:
>
> 5. void foo1()
> {
> if(A Then {_/* */}
> else
> if(C then foo2()
> }
> How many time foo2() would get called given
> A foo1() is called 5000 times
>
> >
>
--~--~-~--~~~---~--~~
You received
Form a word with each row(concatenation of all chars in the row). Similarly
for column and diagonal.
There would be 3n words. Find if the single word to be found is a substring
of the 3n words.
Since reverse is also possible, we might need to check the substring of the
reverse of 3n words.
O(n^2).
Let PH(j,w) be the probability of getting w heads from 1...j coins,
0<=j<=k, 0<=w<=k.
So we have:
PH(0,0) = 1
PH(0,w) = 0 for w>0
PH(j,0) = (1-P(1))(1-P(2))...(1-P(j))
PH(j,w) = PH(j-1,w) + PH(j-1,w-1)PH(j)
Any comments?
On Sep 9, 5:50 pm, Nagendra Kumar wrote:
> @all:
> There are k
5. void foo1()
{
if(Ahttp://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---
All of you guys must have played a game in which a 2-D Matrix of characters
is given. The goal to find words which satisfy some criteria (eg. Names of
various countries etc...) The words can
be present horizontally, vertically and
diogonally both in forward and reverse order.
This is a pretty toug
At the end only one demon will be alive ...
On Sep 14, 2:16 pm, ankur aggarwal wrote:
> @dufus
> plz clearify
> i know u have something in mind..
>
> thanxs
>
> On Sun, Sep 13, 2009 at 11:26 PM, Dufus wrote:
>
> > Old wine in new bottle.
> > Try induction.
>
> > _dufus
>
> > On Sep 13, 10:23 pm
This problem is 'Reservoir Sampling Problem.
http://gregable.com/2007/10/reservoir-sampling.html
On Thu, Sep 17, 2009 at 1:20 PM, manish bhatia wrote:
> There is an infinite tape running, churning out numbers. You are able to
> see these numbers one by one, but not allowed to store all of the
@Anil
Thats right O(n,n) time complexity for k=O(n).
Still it is better than Rama's O(n*m*log k)
which would be order O(n.n.logn) in worst case.
// sorry for the delay in response. I was away for a week with no
access to internet
_dufus
On Sep 15, 11:19 am, Anil C R wrote:
> @dufus
> if extrac
There is an infinite tape running, churning out numbers. You are able to see
these numbers one by one, but not allowed to store all of them, but you should
be ready with k numbers whenever prompted, such that all have been selected
with equal probability. Say, when you were prompted, n numbers h