Not that I am trying to prove a point...but just trying to clarify
what I said...
A uniform random number generator,
say rand_5() produces a value 2 with probability 1/5
it can produce a sequence of two 2s with probability (1/5)^2
it can produce a sequence of three 2s with probability (1/5)^3
well..will this work?
x + y = SUM(1:N+2) - SUM(array) = a
x^2 + y^2 = SUM(1^2:(N+2)^2) - SUM(array.^2) = b
so (a^2 - b) = 2xy
so xy = (a^2-b)/2 = k (say)
now,
x + (k/x) = a
x^2 + k = ax
(x, y) = (a +/- sqrt(a^2-4k))/2
I may not have written the equations correctly (need coffee !!!)
but you
Well. I would suggest the following.
If n is the number of stackable objects,
You could compute the largest value of x such that x*(x+1)/2 = n
Then you can arrange the objects as
O
OO
OOO
O..O (x objects)
Now the remaining can be placed in the last row.
Without violating the constraints this
Its not clear that just a primality test would close the deal...The
sequence 1,3,7,13...does not have 5 which is prime.
If you consider a number 'n' for it to be removed in round 2 (n%2)==0
For it to be removed in round 3 (n-floor(n/2))%3==0 (The floor of n/2
to accommodate all the numbers thrown
I am not an expert with markov chains, but I hope this pointer helps.
http://rubyquiz.com/quiz74.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Yes...|E| has to be greater than or equal to |V|, otherwise we know
that there cannot be a root node.
Then do a simple BFS, since O(|E|)O(|V|), we can technically call it O(|E|)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
Isn't n-2^logn = 0?
since 2^logn = n if you are talking about log base 2
--~--~-~--~~~---~--~~
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
RANDOM(0,1)*(b-a)+a
On Mon, Apr 14, 2008 at 10:15 AM, deeepanshu shukla
[EMAIL PROTECTED] wrote:
hello everybody ...
can anyone help me solving this
Describe an implementation of the procedure RANDOM(a, b) that only makes
calls to
RANDOM(0, 1). What is the expected running
Correct that to : There exists at least one vertex of degree at most 5
--~--~-~--~~~---~--~~
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
I agree with you..I was replying to
kunzmilan:
Planarity can be defined differently. Graph K(4) Can be drawn without crossing
arcs. Newertheless, as tetrahedron, it is not planar. To both forms, different
distance matrices belong.
--~--~-~--~~~---~--~~
You
keep track of the last node you visited...
if you are coming from the left child, go to the right child...
if you are coming from the right child, go to the parent...
thats the brief idea...
--~--~-~--~~~---~--~~
You received this message because you are subscribed
assume parent pointers...then you can
--~--~-~--~~~---~--~~
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
12 matches
Mail list logo