The Wikipedia page proposes two alternatives:
- the first one is recursive
- the second one is iterative
Although they are fully working, and the recursive one is elegant to be read, when I found myself in implementing it in JavaScript to compare pairs of tweet texts, the recursive one wouldn't come to a result. It took ages and did not finish the computation for the pair of provided strings!
Thus, I found this nice test case which compares the two versions (in JavaScript):
[Oh, well, why JavaScript? Tweets are collected in JSON format and stored in MongoDB, and when you are required to analyze in a quick-and-dirty manner your dataset, you can JavaScript functions directly via the MongoDB console]