String matching is a fundamental problem in algorithm. This study examines the development and construction of two reversible string-matching algorithms: a naive string-matching algorithm and the Rabin-Karp algorithm. The algorithms are used to introduce reversible computing concepts, beginning from basic reversible programming techniques to more advanced considerations about the injectivization of the polynomial hash-update function employed by the Rabin-Karp algorithm. The results are two clean input-preserving reversible algorithms that require no additional space and have the same asymptotic time complexity as their classic irreversible originals. This study aims to contribute to the body of reversible algorithms and to the discipline of reversible programming.
翻译:字符串匹配是算法中的一个基本问题。 本研究考察了两种可逆弦匹配算法的开发和构建:一种天真的弦匹配算法和Rabin-Karp算法。这些算法用于引入可逆计算概念,从基本的可逆编程技术开始,到对Rabin-Karp算法使用的多角度散列功能的注射进行更深入的考虑。结果为两种干净的可逆输入保存可逆算法,这些算法不需要额外的空间,并且具有与经典的不可逆原始法相同的同样简单的时间复杂性。本研究的目的是为可逆算法的主体和可逆编程的纪律做出贡献。