An O(ND) Difference Algorithm and Its Variations (1986)
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
The problems of finding a longest common subsequence of two sequences A and B and a shortest edit script for transforming A into B have long been known to be dual problems. In this paper, they are shown to be equivalent to finding a shortest/longest path in an edit graph. Using this perspective, a simple O(ND) time and space algorithm is developed where N is the sum of the lengths of A and B and D is the size of the minimum edit script for A and B. The algorithm performs well when differences are small (sequences are similar) and is consequently fast in typical applications. The algorithm is shown to have O(N +D expected-time performance under a basic stochastic model. A refinement of the algorithm requires only O(N) space, and the use of suffix trees leads to an O(NlgN +D ) time variation.
Myers1986AnONDDifferenceAlgorithm.pdf http://se-pubs.dbs.uni-leipzig.de/files/Myers1986AnONDDifferenceAlgorithm.pdf
An O(ND) Difference Algorithm and Its Variations∗ EUGENE W. MYERS Department of Computer Science, University of Arizona, Tucson, AZ 85721, U.S.A. ABSTRACT The problems of finding a longest common subsequence of two sequences A and B and a shortest edit script for transforming A into B have long been known to be dual problems. In this paper, they are shown to be equivalent to finding a shortest/longest path in an edit graph. Using this perspective, a simple O(ND) time and space algorithm is developed where N is the sum of the lengths of A and B and D is the size of the minimum edit script for A and B. The algorithm performs well when differences are small (sequences are similar) and is consequently fast in typical applications. The algorithm is shown to have O(N + D 2 ) expected-time performance under a basic stochastic model. A refinement of the algorithm requires only O(N) space, and the use of suffix trees leads to an O(NlgN + D 2 ) time variation.
An O(ND) Difference Algorithm and Its Variations (1986)的更多相关文章
- Falcon Genome Assembly Tool Kit Manual
Falcon Falcon: a set of tools for fast aligning long reads for consensus and assembly The Falcon too ...
- 动态规划处理diff算法 Myers Diff (正向)
Eugene W. Myers 在他1986年发表于"Algorithmica"的论文"An O(ND) Difference Algorithm and Its Var ...
- 【原创】Google的文本内容对比代码
/* * Diff Match and Patch * * Copyright 2006 Google Inc. * http://code.google.com/p/google-diff-matc ...
- Myers差分算法的理解、实现、可视化
作者:Oto_G QQ: 421739728 目录 简介 基础 差异的描述 好的差异比较 算法介绍 名词解释 两个定理 绘制编辑图 感谢 简介 本文章对Myers差分算法(Myers Diff Alg ...
- Android DiffUtil
Android 的recyclerview-v7:24.2.0 发布后多了个DiffUtil工具类,这个工具类能够大大解放了Android开发者的一个苦恼:RecyclerView局部刷新和重新刷新时 ...
- linux timing profile
double getUnixTime(void) { struct timespec tv; ) ; return (((double) tv.tv_sec) + (double) (tv.tv_ns ...
- 【翻译】理解 LSTM 及其图示
目录 理解 LSTM 及其图示 本文翻译自 Shi Yan 的博文 Understanding LSTM and its diagrams,原文阐释了作者对 Christopher Olah 博文 U ...
- Leetcode 446.等差数列划分II 子序列
等差数列划分II 子序列 如果一个数列至少有三个元素,并且任意两个相邻元素之差相同,则称该数列为等差数列. 例如,以下数列为等差数列: 1, 3, 5, 7, 9 7, 7, 7, 7 3, -1, ...
- Code Project精彩系列(转)
Code Project精彩系列(转) Code Project精彩系列(转) Applications Crafting a C# forms Editor From scratch htt ...
随机推荐
- 九度oj 题目1035:找出直系亲属
题目描述: 如果A,B是C的父母亲,则A,B是C的parent,C是A,B的child,如果A,B是C的(外)祖父,祖母,则A,B是C的grandparent,C是A,B的grandchild ...
- shrio注解的方式进行权限控制
除了通过API方式外,Shiro 提供Java 5+注解的集合,以注解为基础的授权控制.在你可以使用Java 注释之前,你需要在你的应用程序中启用AOP 支持. Shiro注解支持AspectJ.sp ...
- iOS学习笔记21-推送证书与秘钥申请
---恢复内容开始--- 一.iOS证书 iOS常用的证书包括开发证书和发布证书,无论是真机调试还是最终发布应用到App Store这两个证书都是必须的,它是iOS开发的基本证书.Xcode7以后真机 ...
- [BZOJ1595] [Usaco2008 Jan]人工湖(单调栈)
传送门 好难的题..至少对我来说. 这题就是模拟从最低的平台注水,然后将最低的填满以后从最低的平台向两边扩展,每次找最近的最低的平台h,然后将水填到h高度. 栈里存的是向外扩展的时候,有时会遇到高度递 ...
- Python脚本实现单据体背景色及字段前景色设置
#PythonEntitySetColor clr.AddReference('Kingdee.BOS.Core') from Kingdee.BOS.Core.DynamicForm.PlugIn. ...
- Peaks BZOJ 3545 / Peaks加强版 BZOJ 3551
Peaks [问题描述] 在Bytemountains有N座山峰,每座山峰有他的高度h_i.有些山峰之间有双向道路相连,共M条路径,每条路径有一个困难值,这个值越大表示越难走,现在有Q组询问,每组询问 ...
- vi 和vim 的区别以及用法
具体用法参考:http://blog.csdn.net/xuesnowce/article/details/53117352 它们都是多模式编辑器,不同的是vim 是vi的升级版本,它不仅兼容vi的所 ...
- windows bat语法
@echo off 表示在这条语句之后,所有执行命令的语句不会显示 setLocal 参考1 rem 注释 :或者:: 参考 set /p 等待用户输入 SET /A express ...
- [OS X实用技巧]机器人应用:一键将图片转换为PNG/JPEG/TIFF
转自:http://www.maczhi.com/archives/2842.html 按教程老出错....试验了后使用: - 取得指定Finder对象,其它不变,但运行后不会出错. OS X实用技巧 ...
- codeforces edu40
H(dp计数) 题意: 有一颗树,最深的点的深度是n,每个深度为i的点都有ai个孩子. 对于1<=k<=2n-2,回答树上有多少点对之间的距离是k,答案对1e9+7取模 n<=500 ...