[algogeeks] prime or not

2007-03-29 Thread Terry
why are strings 1, 1001,1001001 ,1001001001, 1001001001001, k*001* where k is the previous string all non primes. i saw an article from dijkstra but couldn't understand other than when sum of string is 3. can someone explain to me why link:

[algogeeks] Re: method to search similar pronunciation words?

2007-03-29 Thread Arun
yes, we can use a min heap of size k to keep track of the top k matching words. On 3/28/07, Dhruva Sagar [EMAIL PROTECTED] wrote: OK! I get it now. In that case what we can do is instead of sorting the result, what we can do is simply while performing a linear search for the words (that are

[algogeeks] Re: prime or not

2007-03-29 Thread Karthik Singaram L
well...its simple as given in the article.. note that the numbers are all decimal numbers (not binary..in case misled by just 0 and 1 in the number) therefore if you have have k copies of 001 and k%3 == 0, then the sum of the digits is divisible by 3 hence the number is divisible by 3 - The

[algogeeks] Re: prime or not

2007-03-29 Thread Karthik Singaram L
In case you are wondering about the part of the proof for k%30, it goes like this, the given number can be written as 1 + 1000 + 100 + 10 +..and so on now if for a given k, if we choose the string of k 1s and try to find the modulus with each of the terms in the above expression, for

[algogeeks] Fwd: [algogeeks] prime or not

2007-03-29 Thread Karthik Singaram L
Oooh...I almost forgot to add this.. notice the relation between the proof for part (ii) and the discrete logarithm problem. The proof is no mere coincidence. This is the reason behind using primes in encryption schemes that rely on the hardness of the discrete logarithm problem. This will ensure

[algogeeks] Re: method to search similar pronunciation words?

2007-03-29 Thread david ullua
Hi, Kevin, you can try soundex. compute each word's soundex, and store these soundex, Listword in a HashMap. for a giving word, compute it's soundex, and just find the soundex in the hashmap. It would cost O(1). good luck. On Mar 29, 9:49 am, Kevin [EMAIL PROTECTED] wrote: This is from an

[algogeeks] getting wrong answer for problem

2007-03-29 Thread mukesh tiwari
hi friends i m trying to solve this problem http://acm.uva.es/p/v111/11151.html but getting wrong answer.. my algorithm is i m trying to enumarate all the n*(n+1)/2 substrings of string ,where n is string length... and checking for palindrom .. suppose i have input ADAM .then all