I know that both Levenshtein and Needleman Wunsch has the time complexity of O(N*M) but I was curious to know which one performs better than the other and why?
Is Levenshtein distance algorithm performs better than Needleman Wunsch Algorithm?
446 views Asked by Azher Ahmed Efat At
2
There are 2 answers
0
On
I've studied both of them, both takes the same time, they are equally efficient, If you want you can see for your self, just print the cpu_clock times in both the algorithms you wont see much difference, (maybe just a few ms, but that too differ from compiler to compiler)
There is no article that would go in detail to compare the two, because it is a waste of time.
These two algorithms do different things, so there is no point in comparing them.
The Levenshtein Distance Algorithm just calculates the Levenshtein distance of two strings (the minimum number of mutations needed to transform one into the other).
The Needleman-Wunsch algorithm finds the optimal alignment between two strings, which can be seen as the operations needed to transform one string into another.
The first part of this is similar to the Levenshtein Distance Algorithm however, so if a time comparison is needed then Needleman-Wunsch will take longer, purely because it actually does more