how can we generate random values which lie in the range [a,b] or
wrire a function for the same
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge
Can you please make question a bit clear. What does minimum distance between
any two points. Do u mean sum of minimum distance?
On Mon, Oct 5, 2009 at 7:52 PM, monty 1987 <1986mo...@gmail.com> wrote:
> We have to locate n points on the x-axis
> For each point xi
> the
We have to locate n points on the x-axis
For each point xi
the x co-ordinate of it lies between a range
[r1i,r2i]
Now we have to decide the location of points such that
minimum { distance between any two points } is maximum.
Any answer is welcomed.
--~--~-
If the array is sorted, doing xor of a[n] and a[n+] will result 0 for
duplicate no.
--Bala
On Mon, Oct 5, 2009 at 7:06 PM, Ramaswamy R wrote:
> Use a bit-field of M bits to keep track of the presence of X..X+M-1. We can
> do 2^32/M passes (if the elements are 32-bit size) to check for numbers i
Use a bit-field of M bits to keep track of the presence of X..X+M-1. We can
do 2^32/M passes (if the elements are 32-bit size) to check for numbers in a
range. Depending on the memory footprint and speed the app would want we can
find a soft spot for X.
On Sun, Oct 4, 2009 at 9:39 PM, Amit Chandak
hi hw about this
for(i=0;iwrote:
>
> Hi Friends,
> Given an array in which all the elements are unique except one element
> which occurs 'twice'. How can we find this repeated element in O(n)
> time and constant space?
>
> Regards,
> Amit.
>
> >
>
--~--~-~--~~~---~--~-
i tried the algorithm with a very simple C program and this is the
output i got ,
from my visual inspection , there was no repetition for the first 98
values after which the cycle started again, this is my output
followed by a simple implementation.
Hope this helps
pdhan...@hansolo:/afs/ece.cmu
hi ,
I think the Linear Congruential Generator is believed to be the most
simple of all PRNGs.
The sequence can be generated using the following,
X(n+1) = (a* Xn +c ) mod m
In the above , your first step would be
X1 = (a*X0 +c ) mod m
X0 is the seed value that you need to feed to the algorithm
Hi Friends,
Given an array in which all the elements are unique except one element
which occurs 'twice'. How can we find this repeated element in O(n)
time and constant space?
Regards,
Amit.
--~--~-~--~~~---~--~~
You received this message because you are subscribe