mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-08 18:32:56 +08:00
docs(DP): update LevenshteinDistance.java
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user