[algogeeks] Re: Judging whether a URL exists among millions, insert if not

2008-08-20 Thread Ashish Chugh
Instead of MD5, I think hashCode will suffice. Also it would be unieque for each url and will take lesser number of bytes. Regards, /Ashish On Wed, Aug 20, 2008 at 2:12 PM, Fred [EMAIL PROTECTED] wrote: Hi, all: I've got such a problem: there are millions of URLs in the database, and

[algogeeks] Re: Find the missing integer

2006-06-22 Thread Ashish Chugh
Hi Anil,The code is the tested one. We are converting binary to num, not num to binary so i/10 is right. I have spared my time and after testing i have given the codecheers,Ashish On 6/21/06, anil kumar [EMAIL PROTECTED] wrote: hi asish, thanks for ur reply.. But ur code takes O(n logn) to find

[algogeeks] Re: Find the missing integer

2006-06-21 Thread Ashish Chugh
public getMissingNum(A[]) {long arraySum = 0;long iSum = 0;for (int i = 0; i n + 1; i++) {iSum += i;arraySum += binaryToNum(A[i]);}missingNum = iSum - arraySum;return missingNum;} public long binaryToNum( i ) {int powBy =0;long num = 0; long currentDigitValue = 0;while ( i 0) { int mod = i % 2;