编辑距离
摘要:好吧。我还没习惯Live Writer。这部分被覆盖掉了。贴回来。编辑距离,编程之美3.3节。这个问题类似于最长公共子序列LCS,所以可以使用DP和滚动数组来简化计算。int editdist(const string& w1, const string& w2) { size_t len1 = w1.length(), len2 = w2.length(); if (len1++ < len2++) return editdist(w2, w1); int* dist = new int[len2]; for (size_t j = 0; j < len2; ++
阅读全文
posted @ 2011-03-11 16:33
浙公网安备 33010602011771号