docs(DP): update LevenshteinDistance.java

This commit is contained in:
Libin Yang
2019-02-23 21:03:57 +08:00
committed by GitHub
parent e4a9d38ee3
commit 09d5cb01f3

View File

@ -1,9 +1,6 @@
/** /**
*
* @author Kshitij VERMA (github.com/kv19971) * @author Kshitij VERMA (github.com/kv19971)
* LEVENSHTEIN DISTANCE dyamic programming implementation to show the difference between two strings (https://en.wikipedia.org/wiki/Levenshtein_distance) * LEVENSHTEIN DISTANCE dyamic programming implementation to show the difference between two strings (https://en.wikipedia.org/wiki/Levenshtein_distance)
*
*
*/ */
public class LevenshteinDistance { public class LevenshteinDistance {
@ -16,6 +13,7 @@ public class LevenshteinDistance{
return c; return c;
} }
} }
private static int calculate_distance(String a, String b) { private static int calculate_distance(String a, String b) {
int len_a = a.length() + 1; int len_a = a.length() + 1;
int len_b = b.length() + 1; int len_b = b.length() + 1;
@ -43,6 +41,7 @@ public class LevenshteinDistance{
return distance_mat[len_a - 1][len_b - 1]; return distance_mat[len_a - 1][len_b - 1];
} }
public static void main(String[] args) { public static void main(String[] args) {
String a = ""; // enter your string here String a = ""; // enter your string here
String b = ""; // enter your string here String b = ""; // enter your string here