How to write the Levenshtein Distance Algorithm for string comparison | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to write the Levenshtein Distance Algorithm for string comparison

Is anyone able to show in pseudocode how one would create a function that calculates Levenshtein Distance for any two strings?

3rd Sep 2019, 9:50 PM
Nathan Stanley
Nathan Stanley - avatar
2 Answers
+ 3
https://en.m.wikipedia.org/wiki/Levenshtein_distance Check the "Computing Levenshtein Distance" section.
3rd Sep 2019, 11:14 PM
Sonic
Sonic - avatar
0
Hi Sonic, thanks for the link. I was able to make this algorithm work! I made it in KVS for KVIrc. See the code in my github: https://github.com/Cabji/kvirc-kvs/blob/master/fnLevenshteinDistance.kvs I don't know if it's exactly correctly implemented, but it seems to give the correct results.
4th Sep 2019, 9:42 AM
Nathan Stanley
Nathan Stanley - avatar