Optimal Square Detection Over General Alphabets

J. Ellert, Paweł Gawrychowski, Garance Gourdel
{"title":"Optimal Square Detection Over General Alphabets","authors":"J. Ellert, Paweł Gawrychowski, Garance Gourdel","doi":"10.1137/1.9781611977554.ch189","DOIUrl":null,"url":null,"abstract":"Squares (fragments of the form $xx$, for some string $x$) are arguably the most natural type of repetition in strings. The basic algorithmic question concerning squares is to check if a given string of length $n$ is square-free, that is, does not contain a fragment of such form. Main and Lorentz [J. Algorithms 1984] designed an $\\mathcal{O}(n\\log n)$ time algorithm for this problem, and proved a matching lower bound assuming the so-called general alphabet, meaning that the algorithm is only allowed to check if two characters are equal. However, their lower bound also assumes that there are $\\Omega(n)$ distinct symbols in the string. As an open question, they asked if there is a faster algorithm if one restricts the size of the alphabet. Crochemore [Theor. Comput. Sci. 1986] designed a linear-time algorithm for constant-size alphabets, and combined with more recent results his approach in fact implies such an algorithm for linearly-sortable alphabets. Very recently, Ellert and Fischer [ICALP 2021] significantly relaxed this assumption by designing a linear-time algorithm for general ordered alphabets, that is, assuming a linear order on the characters that permits constant time order comparisons. However, the open question of Main and Lorentz from 1984 remained unresolved for general (unordered) alphabets. In this paper, we show that testing square-freeness of a length-$n$ string over general alphabet of size $\\sigma$ can be done with $\\mathcal{O}(n\\log \\sigma)$ comparisons, and cannot be done with $o(n\\log \\sigma)$ comparisons. We complement this result with an $\\mathcal{O}(n\\log \\sigma)$ time algorithm in the Word RAM model. Finally, we extend the algorithm to reporting all the runs (maximal repetitions) in the same complexity.","PeriodicalId":92709,"journal":{"name":"Proceedings of the ... Annual ACM-SIAM Symposium on Discrete Algorithms. ACM-SIAM Symposium on Discrete Algorithms","volume":"110 1","pages":"5220-5242"},"PeriodicalIF":0.0000,"publicationDate":"2023-03-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the ... Annual ACM-SIAM Symposium on Discrete Algorithms. ACM-SIAM Symposium on Discrete Algorithms","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1137/1.9781611977554.ch189","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

Abstract

Squares (fragments of the form $xx$, for some string $x$) are arguably the most natural type of repetition in strings. The basic algorithmic question concerning squares is to check if a given string of length $n$ is square-free, that is, does not contain a fragment of such form. Main and Lorentz [J. Algorithms 1984] designed an $\mathcal{O}(n\log n)$ time algorithm for this problem, and proved a matching lower bound assuming the so-called general alphabet, meaning that the algorithm is only allowed to check if two characters are equal. However, their lower bound also assumes that there are $\Omega(n)$ distinct symbols in the string. As an open question, they asked if there is a faster algorithm if one restricts the size of the alphabet. Crochemore [Theor. Comput. Sci. 1986] designed a linear-time algorithm for constant-size alphabets, and combined with more recent results his approach in fact implies such an algorithm for linearly-sortable alphabets. Very recently, Ellert and Fischer [ICALP 2021] significantly relaxed this assumption by designing a linear-time algorithm for general ordered alphabets, that is, assuming a linear order on the characters that permits constant time order comparisons. However, the open question of Main and Lorentz from 1984 remained unresolved for general (unordered) alphabets. In this paper, we show that testing square-freeness of a length-$n$ string over general alphabet of size $\sigma$ can be done with $\mathcal{O}(n\log \sigma)$ comparisons, and cannot be done with $o(n\log \sigma)$ comparisons. We complement this result with an $\mathcal{O}(n\log \sigma)$ time algorithm in the Word RAM model. Finally, we extend the algorithm to reporting all the runs (maximal repetitions) in the same complexity.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
通用字母的最优平方检测
正方形(对于某些字符串来说,形式为$xx$的片段$x$)可以说是字符串中最自然的重复类型。关于平方的基本算法问题是检查长度为$n$的给定字符串是否无平方,也就是说,不包含这种形式的片段。Main和Lorentz [J]。Algorithms 1984]针对这个问题设计了一个$\mathcal{O}(n\log n)$时间算法,并证明了一个假设所谓通用字母表的匹配下界,即算法只允许检查两个字符是否相等。但是,它们的下界还假设字符串中有$\Omega(n)$不同的符号。作为一个开放的问题,他们问,如果限制字母表的大小,是否有更快的算法。克罗切莫尔[理论]计算。Sci. 1986]为恒定大小的字母设计了一个线性时间算法,结合最近的结果,他的方法实际上暗示了这样一个线性排序字母的算法。最近,Ellert和Fischer [ICALP 2021]通过为一般有序字母设计线性时间算法显著放宽了这一假设,即假设字符上的线性顺序允许常数时间顺序比较。然而,从1984年开始,对于通用(无序)字母,美因和洛伦兹的开放问题仍然没有解决。在本文中,我们证明了长度- $n$字符串在大小为$\sigma$的一般字母表上的平方自由度测试可以用$\mathcal{O}(n\log \sigma)$比较来完成,而不能用$o(n\log \sigma)$比较来完成。我们用Word RAM模型中的$\mathcal{O}(n\log \sigma)$时间算法来补充这个结果。最后,我们将算法扩展到报告相同复杂度下的所有运行(最大重复)。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
CiteScore
6.50
自引率
0.00%
发文量
0
期刊最新文献
A Polynomial Time Algorithm for Finding a Minimum 4-Partition of a Submodular Function Player-optimal Stable Regret for Bandit Learning in Matching Markets Optimal Square Detection Over General Alphabets Fully Dynamic Exact Edge Connectivity in Sublinear Time Maximal k-Edge-Connected Subgraphs in Weighted Graphs via Local Random Contraction
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1