Skip to content
Permalink
Browse files

fix variable names in levenshtein distance python and cpp solutions

  • Loading branch information
prbroadfoot committed Dec 10, 2019
1 parent cc12c05 commit 57b320c811fdbbc0ec5ec422fe1f393584d10623
@@ -42,9 +42,9 @@ int ComputeDistanceBetweenPrefixes(
int substitute_last = ComputeDistanceBetweenPrefixes(
A, A_idx - 1, B, B_idx - 1, distance_between_prefixes_ptr);
int add_last = ComputeDistanceBetweenPrefixes(
A, A_idx - 1, B, B_idx, distance_between_prefixes_ptr);
int delete_last = ComputeDistanceBetweenPrefixes(
A, A_idx, B, B_idx - 1, distance_between_prefixes_ptr);
int delete_last = ComputeDistanceBetweenPrefixes(
A, A_idx - 1, B, B_idx, distance_between_prefixes_ptr);
distance_between_prefixes[A_idx][B_idx] =
1 + min({substitute_last, add_last, delete_last});
}
@@ -18,8 +18,8 @@ def compute_distance_between_prefixes(A_idx, B_idx):

substitute_last = compute_distance_between_prefixes(
A_idx - 1, B_idx - 1)
add_last = compute_distance_between_prefixes(A_idx - 1, B_idx)
delete_last = compute_distance_between_prefixes(A_idx, B_idx - 1)
add_last = compute_distance_between_prefixes(A_idx, B_idx - 1)
delete_last = compute_distance_between_prefixes(A_idx - 1, B_idx)
return 1 + min(substitute_last, add_last, delete_last)

return compute_distance_between_prefixes(len(A) - 1, len(B) - 1)

0 comments on commit 57b320c

Please sign in to comment.
You can’t perform that action at this time.