What is the space complexity of the above implementation of Wagner-Fischer algorithm where "m" and "n" are the lengths of the two strings?
O(1)
O(n+m)
O(mn)
O(nlogm)
Answer and explanation
The space complexity of the above Wagner-Fischer algorithm is O(mn).
