Re: [algogeeks] Re: String Operation

2011-02-26 Thread saltycookie
If strings do not have same lengths, this simple greedy algorithm does not work. E.g. b ba bab The best answer is bababb, instead of bbabab. A correct way is to define a new string comparison operator, and concatenate strings in that order: bool comp(const string &a, const string &b) { retu

Re: [algogeeks] Lets C Who Really Loves Perfect Square .................

2011-02-26 Thread saltycookie
Why not try all possibilities? Not many numbers to enumerate. 2011/2/23 bittu > How to find a number of 10 digits (non repeated digits) which is a > perfect square? perfect square examples: 9 (3x3) 16 (4x4) 25(5x) etc. > Ten digit number example 1,234,567,890 > > > > Thanks & Regards > Shashank

Re: [algogeeks] Dijkstra For Longest Path?

2010-01-14 Thread saltycookie
longest path is NP-hard 2010/1/11 Johan > Ok, so I know that Dijkstra can be used to solve the single-source > shortest path problem quite efficiently. I however need to find the > single source longest path through a graph. Can Dijkstra be used for > this if I transform the edge lengths so that

[algogeeks] Re: Good problem

2009-10-22 Thread saltycookie
It is not a solution for minimize maximum distance either, since |x(i)-x(j)| <= c does not hold for every pair of points, only for adjacent points. 2009/10/21 saltycookie > Yes, you are quite right. If I am not mistaken, you give a good solution > for finding the minimum maximum

[algogeeks] Re: Good problem

2009-10-21 Thread saltycookie
Yes, you are quite right. If I am not mistaken, you give a good solution for finding the minimum maximum distance. But what about the original problem where we want to find the maximum minimum distance? I am not clear about the connection between the two problems. Thanks. 2009/10/21 Dave > > 林

[algogeeks] Re: interesting game

2009-10-02 Thread saltycookie
of numbers and that would depend on > distribution of primes... > So it occurs to me that there might not be a "closed form" winning > strategy possible ! > > Still thanks for the proof ! > > cheers > > - > nikhil > Every single person has a slim shady lurki

[algogeeks] Re: interesting game

2009-10-01 Thread saltycookie
Here is a proof. Unfortunately, the proof is not constructive.The secret of winning is "1", which is a fator of every integer. If the first player(player A) can win by removing a number between 2 to n, then our hypothesis holds. Or else, A can't win by removing any number between 2 to n. We denot

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a special char, say '$' to the beginning of the world, and get "$world

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a special char, say '$' to the beginning of the world, and get "$world

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a special char, say '$' to the beginning of the world, and get "$world

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a special char, say '$' to the beginning of the world, and get "$world

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a special char, say '$' to the beginning of the world, and get "$world

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a special char, say '$' to the beginning of the world, and get "$world

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
I think the way google deals with spell error is quite complex. But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a spec

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a special char, say '$' to the beginning of the world, and get "$world

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a special char, say '$' to the beginning of the world, and get "$world

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a special char, say '$' to the beginning of the world, and get "$world

[algogeeks] Re: string comparison ignoring one char

2009-09-25 Thread saltycookie
But if you just wanna find candidates for spell errors with one char (miss, add or misspell one char), you may store several version of the word in the database. Here is one possible implementation: For "world", we first add a special char, say '$' to the beginning of the world, and get "$world