[algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-07 Thread Dumanshu
@Victor: Instead of 0 and 1, shouldn't it be like DP[i-1][j-1] + 0 and DP[i-1] [j-1] + 1 On Sep 7, 1:10 am, Victor Manuel Grijalva Altamirano kavic1.mar...@gmail.com wrote: Try with DP, a little modicated of Edit Distance algorithm State i=the begin of the word , j=the end of the word

[algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread Ankuj Gupta
I guess we cant modify the original string. For yahoo should it be yahoohay ? Please clarify On Sep 6, 12:56 am, Pratz mary pratima.m...@gmail.com wrote: int main() {     char *s=nitan;     int n,i,j,c=0;     char *d;     n=strlen(s)/2;     //printf(%d,n);     for(i=1;i=n;i++)     {  

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread anshu mishra
http://www.spoj.pl/problems/AIBOHP/ same problem u have asked!! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread Atul Modi
can u remove letters also?as in the example 1 'o' seems to have been removed? On Tue, Sep 6, 2011 at 12:25 PM, anshu mishra anshumishra6...@gmail.comwrote: http://www.spoj.pl/problems/AIBOHP/ same problem u have asked!! -- You received this message because you are subscribed to the

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread sukran dhawan
my soln works without increasing the string length just start with first and last character copy last character with first increment i and decrement j and contibue the procedure continue the same till u get mid element :) On Tue, Sep 6, 2011 at 12:56 PM, Atul Modi atul.a...@gmail.com wrote:

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread surender sanke
@sukran, string shouldn't be replaced, only addition of characters allowed On Tue, Sep 6, 2011 at 1:48 PM, sukran dhawan sukrandha...@gmail.comwrote: my soln works without increasing the string length just start with first and last character copy last character with first increment i and

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread Shravan Kumar
@Yamini Please read the subject of this mail On Tue, Sep 6, 2011 at 7:54 PM, yamini gupta adorableyamin...@gmail.comwrote: add all the characters present in the string in reversed order to the string On Sep 6, 1:26 pm, surender sanke surend...@gmail.com wrote: @sukran, string shouldn't be

[algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-06 Thread Brijesh
This can be solve by considering following case: i) If all the letters in the word are distinct : Just concatenate, reverse of the string(excluding last letter) to the original word..e.g. ZXKH==ZXKH KXZ ii)If two letters are same in the word : First ignore all the letters between those same

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-05 Thread Pratz mary
for yahoo shudnt min additions be yahay? On 6 September 2011 00:48, learner nimish7andr...@gmail.com wrote: @sandeep Explain Algorithm/logic Time Complexity ? Thanks -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] Re: convert a word into a palindrome with minimum addition of letters to it

2011-09-05 Thread Pratz mary
int main() { char *s=nitan; int n,i,j,c=0; char *d; n=strlen(s)/2; //printf(%d,n); for(i=1;i=n;i++) { if(s[n-i]!=s[n+i]) break; } d=strcpy(d,s); for(j=i;j=n;j++) { if(d[n+j]!=d[n-j]) { c++; d[n+j]=d[n-j]; } }