The Longest Common Substring (LCS) and Longest Palindromic Substring (LPS) are classical problems in computer science, representing fundamental challenges in string processing. Both problems can be solved in linear time using a classical model of computation, by means of very similar algorithms, both relying on the use of suffix trees. Very recently, two sublinear algorithms for LCS and LPS in the quantum query model have been presented by Le Gall and Seddighin~\cite{GallS23}, requiring $\tilde{\mathcal{O}}(n^{5/6})$ and $\tilde{\mathcal{O}}(\sqrt{n})$ queries, respectively. However, while the query model is fascinating from a theoretical standpoint, its practical applicability becomes limited when it comes to crafting algorithms meant for actual execution on real hardware. In this paper we present, for the first time, a $\tilde{\mathcal{O}}(\sqrt{n})$ quantum algorithm for both LCS and LPS working in the circuit model of computation. Our solutions are simpler than previous ones and can be easily translated into quantum procedures. We also present actual implementations of the two algorithms as quantum circuits working in $\mathcal{O}(\sqrt{n}\log^5(n))$ and $\mathcal{O}(\sqrt{n}\log^4(n))$ time, respectively.
翻译:最长公共子串(LCS)与最长回文子串(LPS)是计算机科学中的经典问题,代表了字符串处理领域的核心挑战。这两个问题在经典计算模型下均可通过非常相似的算法在线性时间内求解,且均依赖于后缀树的使用。近期,Le Gall与Seddighin在量子查询模型中提出了LCS与LPS的两个亚线性算法~\cite{GallS23},分别需要$\tilde{\mathcal{O}}(n^{5/6})$和$\tilde{\mathcal{O}}(\sqrt{n})$次查询。然而,尽管查询模型在理论层面极具吸引力,其实际应用在针对真实硬件执行的算法设计上存在局限。本文首次在电路计算模型中提出了针对LCS与LPS的$\tilde{\mathcal{O}}(\sqrt{n})$量子算法。我们的解决方案较以往方法更为简洁,且易于转化为量子程序。我们还给出了这两个算法的实际量子电路实现,其运行时间分别为$\mathcal{O}(\sqrt{n}\log^5(n))$和$\mathcal{O}(\sqrt{n}\log^4(n))$。