串对串校正算法

发布于 2024-11-30 21:36:52 字数 348 浏览 3 评论 0原文

我不确定我是否正确地命名了这篇文章,但我想知道这种类型的算法是否有一个名称:

我想要完成的是创建一个最小指令集从一个字符串到它的排列,例如:

    STACKOVERFLOW -> STAKCOVERFLOW

将需要至少一个操作,即是否

    shift K before C.

有任何好的在线示例来

  1. 查找最小指令集(我相信这也经常出现)称为编辑距离),并
  2. 列出指令集

谢谢!

I'm not sure I've titled this post correctly, but I'm wondering if there's a name for this type of algorithm:

What I'm trying to accomplish is to create a minimal set of instructions to go from one string to its permutation, so for example:

    STACKOVERFLOW -> STAKCOVERFLOW

would require a minimum of one operation, which is to

    shift K before C.

Are there any good online examples of

  1. Finding the minimum instruction set (I believe this is also often called the edit distance), and
  2. Listing the instruction set

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盛装女皇 2024-12-07 21:36:52

有一种称为编辑距离的东西可以告诉您从一个字符串到另一个字符串需要进行多少次更改,并且有许多 C# 实现,还有许多其他语言。

这是维基:

http://en.wikipedia.org/wiki/Levenshtein_distance

编辑:As TheHorse已经表明,Levenshtein距离不理解Shift的变化,但是有一个改进的算法:

Damerau-Levenshtein 距离

There is something known as the Levenshtein distance that tells you how many changes are needed to go from one string to another and there are many C# implementations, many other languages too.

Here's the wiki:

http://en.wikipedia.org/wiki/Levenshtein_distance

Edit: As TheHorse has indicated, the Levenshtein distance doesn't understand Shift changes, but there is an improved algorithm:

Damerau-Levenshtein distance

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文