I am trying to calculate the worst case scenario time complexity for finding the edit distance from T
test words to D
dictionary words, where all words have a length MAX_LEN
.
Asked
Active
Viewed 526 times
1

blurred42
- 19
- 3
1 Answers
1
Worst time complexity can be exponential, O(3^MAX_LEN)
when using a naive recursive solution. The worst-case happens when none of the characters of two strings match.

Ashok Arora
- 531
- 1
- 6
- 17
-
What if you are not using the recursive solution, but a bottom-up dynamic programming solution? Does that change the complexity? – blurred42 Apr 26 '21 at 21:15
-
@blurred42 Using a bottom-up DP solution reduces the time complexity to `O(MAX_LEN^2)` which is polynomial time but also increases space complexity to the same. – Ashok Arora Apr 26 '21 at 21:22