I have been given a algorithm about The Levenshtein distance between two character strings and is defined as the minimum number of single-character insertions, deletions, or substitutions (so-called edit operations) required to transform string into string .
The algorithm in pseudo code is:
I have counted the number of recursive calls which is 3 and number of elements is N - 2 (since function () of the total number ≔ + of input characters). So I got the recurrence as T(N) = 3T(N-2) + dN. But I'm not sure it could be constant d or proportional dN. Using the Master Theorem, I got 2^(N log(3)) with base is 4. I need some help to get the right recurrence for the worst case, and how to determine dN or d. Thank you.``