hi hw about this
for(i=0;in;++i)
{
if(a[a[i]]!=a[i]flag==0)
{
a[a[i]]=a[i];
flag=1;
}
else
{
couta[i] is duplicate element;
}
}
if range is high we hash take mod of that elemnt with big value and hash it
in same array and check for collision
On Mon, Oct 5, 2009 at 10:09 AM, Amit Chandak
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
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 ramaswam...@gmail.com 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