计算字符串的相似度
来源:互联网 发布:广联达定额预算软件 编辑:程序博客网 时间:2024/05/12 19:56
Int CalculateStringDistance(string strA, int pABegin, int pAEnd, string strB, int pBBegin, int pBEnd)
{
if (pABegin > pAEnd)
{
if (pBBegin > pBEnd)
return 0;
else
return pBEnd - pBBegin + 1;
}
if (pBBegin > pBEnd)
{
if (pABegin > pAEnd)
return 0;
else
return pAEnd - pABegin + 1;
}
if (strA[pABegin] == strB[pBBegin])
{
return CalculateStringDistance(strA, pABegin + 1, pAEnd, strB, pBBegin + 1, pBEnd);
}
else
{
int t1 = CalculateStringDistance(strA, pABegin + 1, pAEnd, strB, pBBegin + 2, pBEnd);
int t2 = CalculateStringDistance(strA, pABegin + 2, pAEnd, strB, pBBegin + 1, pBEnd);
int t3 = CalculateStringDistance(strA, pABegin + 2, pAEnd, strB, pBBegin + 2, pBEnd)
return minValue(t1, t2, t3) + 1;
}
}
0 0
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度。
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- 计算字符串的相似度
- uniVocity-parsers:一款强大的CSV/TSV/定宽文本文件解析库(Java)
- 时域与频域一
- Ubuntu安装Ganglia并监控Hadoop集群
- 为固定长宽的ImageView中的Bitmap添加边框
- 数字签名是什么?
- 计算字符串的相似度
- Eclipse 乱码问题 修改设置
- Xcode高级调试技巧
- 黑马程序员——OC基础:block和Protocol及Category
- Missing number(5166)
- 二进制炸弹BOMB报告
- 《剑指Offer》面试题4习题
- c++
- C:\Vim\_vimrc