Data Structures & AlgorithmsModerateTCS NQT · string DP

Problem: What is the time complexity of the Wagner-Fischer dynamic programme for edit distance on strings of length n and m?

  1. A. O(n + m)
  2. B. O(2^{n+m})
  3. C. O(nm)
  4. D. O(n log m)

Correct answer: C. O(nm)

Each of the n*m cells is filled in constant time from three neighbours.

More Coding Interview Problems questions

Exams that ask this topic