mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
strings: levenshtein_distance: remove costs calculation for default array
This commit is contained in:
@@ -1833,6 +1833,9 @@ levenshtein_distance :: proc(a, b: string, allocator := context.allocator) -> in
|
|||||||
|
|
||||||
if n + 1 > len(LEVENSHTEIN_DEFAULT_COSTS) {
|
if n + 1 > len(LEVENSHTEIN_DEFAULT_COSTS) {
|
||||||
costs = make([]int, n + 1, allocator)
|
costs = make([]int, n + 1, allocator)
|
||||||
|
for k in 0..=n {
|
||||||
|
costs[k] = k
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
costs = LEVENSHTEIN_DEFAULT_COSTS
|
costs = LEVENSHTEIN_DEFAULT_COSTS
|
||||||
}
|
}
|
||||||
@@ -1841,10 +1844,6 @@ levenshtein_distance :: proc(a, b: string, allocator := context.allocator) -> in
|
|||||||
delete(costs, allocator)
|
delete(costs, allocator)
|
||||||
}
|
}
|
||||||
|
|
||||||
for k in 0..=n {
|
|
||||||
costs[k] = k
|
|
||||||
}
|
|
||||||
|
|
||||||
i: int
|
i: int
|
||||||
for c1 in a {
|
for c1 in a {
|
||||||
costs[0] = i + 1
|
costs[0] = i + 1
|
||||||
|
|||||||
Reference in New Issue
Block a user