I think, it is because of the preference of operations. I have also implemented it and it's returning 5. Try for some modifications in the algorithm.
On Tue, May 24, 2011 at 10:47 PM, Akshata Sharma <akshatasharm...@gmail.com>wrote: > @Akash: > I have implemented Demarau-Levenshtein algorithm but for the eg. I gave > above, it outputs 5 instead of 4. For some inputs it is giving the correct > output. > I think the demarau-levenshtein algo is just: > > if(I>0 && J>0 && s1[I]==s2[J-1] && s1[I-1]==s2[J]) > table[i][j] = > min(min(table[i-1][j]+1,table[i][j-1]+1),min(table[i-1][j-1]+1,table[i-2][j-2]+1)); > else > table[i][j] = > min(min(table[i-1][j]+1,table[i][j-1]+1),table[i-1][j-1]+1); > > > > > On Wed, May 25, 2011 at 10:55 AM, Aakash Johari <aakashj....@gmail.com>wrote: > >> Use Demarau-Levenshtein for this purpose :) >> >> On Tue, May 24, 2011 at 10:24 PM, Akshata Sharma < >> akshatasharm...@gmail.com> wrote: >> >>> what changes should we make in the edit distance algorithm to include the >>> swapping of adjacent elements so as to get min edit distance? >>> >>> eg. "pantera" can be converted into "aorta" by 4 edits. >>> "pantera” >>> “antera” >>> “antra” >>> “aotra” >>> “aorta” >>> >>> -- >>> 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 >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> -Aakash Johari >> (IIIT Allahabad) >> >> >> >> >> -- >> 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 >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > 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 > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- -Aakash Johari (IIIT Allahabad) -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.