{"title":"Faster and simpler online computation of string net frequency","authors":"Shunsuke Inenaga","doi":"10.1016/j.ipl.2026.106620","DOIUrl":null,"url":null,"abstract":"<div><div>An occurrence of a repeated substring <em>u</em> in a string <em>S</em> is called a <em>net occurrence</em> if extending the occurrence to the left or to the right decreases the number of occurrences to 1. The <em>net frequency</em> (<em>NF</em>) of a repeated substring <em>u</em> in a string <em>S</em> is the number of net occurrences of <em>u</em> in <em>S</em>. Very recently, Guo et al. [SPIRE 2024] proposed an online <em>O</em>(<em>n</em>log <em>σ</em>)-time algorithm that maintains a data structure of <em>O</em>(<em>n</em>) space which answers <span>Single-NF</span> queries in <span><math><mrow><mi>O</mi><mo>(</mo><mi>m</mi><mi>log</mi><mi>σ</mi><mo>+</mo><msup><mi>σ</mi><mn>2</mn></msup><mo>)</mo></mrow></math></span> time and reports all answers of the <span>All-NF</span> problem in <em>O</em>(<em>nσ</em><sup>2</sup>) time. Here, <em>n</em> is the length of the input string <em>S, m</em> is the query pattern length, and <em>σ</em> is the alphabet size. The <em>σ</em><sup>2</sup> term is a major drawback of their method since computing string net frequencies is originally motivated for Chinese language text processing where <em>σ</em> can be thousands large. This paper presents an improved online <em>O</em>(<em>n</em>log <em>σ</em>)-time algorithm, which answers <span>Single-NF</span> queries in <em>O</em>(<em>m</em>log <em>σ</em>) time and reports all answers to the <span>All-NF</span> problem in output-optimal <span><math><mrow><mi>O</mi><mo>(</mo><mo>|</mo><msup><mi>NF</mi><mo>+</mo></msup><mrow><mo>(</mo><mi>S</mi><mo>)</mo></mrow><mo>|</mo><mo>)</mo></mrow></math></span> time, where <span><math><mrow><msup><mi>NF</mi><mo>+</mo></msup><mrow><mo>(</mo><mi>S</mi><mo>)</mo></mrow></mrow></math></span> is the set of substrings of <em>S</em> paired with their positive NF values. We note that <span><math><mrow><mrow><mo>|</mo></mrow><msup><mi>NF</mi><mo>+</mo></msup><mrow><mrow><mo>(</mo><mi>S</mi><mo>)</mo></mrow><mo>|</mo><mo>=</mo><mi>O</mi><mrow><mo>(</mo><mi>n</mi><mo>)</mo></mrow></mrow></mrow></math></span> always holds. In contrast to Guo et al.’s algorithm that is based on Ukkonen’s suffix tree construction, our algorithm is based on Weiner’s suffix tree construction.</div></div>","PeriodicalId":56290,"journal":{"name":"Information Processing Letters","volume":"193 ","pages":"Article 106620"},"PeriodicalIF":0.6000,"publicationDate":"2026-04-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Information Processing Letters","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0020019026000013","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2026/1/15 0:00:00","PubModel":"Epub","JCR":"Q4","JCRName":"COMPUTER SCIENCE, INFORMATION SYSTEMS","Score":null,"Total":0}
引用次数: 0
Abstract
An occurrence of a repeated substring u in a string S is called a net occurrence if extending the occurrence to the left or to the right decreases the number of occurrences to 1. The net frequency (NF) of a repeated substring u in a string S is the number of net occurrences of u in S. Very recently, Guo et al. [SPIRE 2024] proposed an online O(nlog σ)-time algorithm that maintains a data structure of O(n) space which answers Single-NF queries in time and reports all answers of the All-NF problem in O(nσ2) time. Here, n is the length of the input string S, m is the query pattern length, and σ is the alphabet size. The σ2 term is a major drawback of their method since computing string net frequencies is originally motivated for Chinese language text processing where σ can be thousands large. This paper presents an improved online O(nlog σ)-time algorithm, which answers Single-NF queries in O(mlog σ) time and reports all answers to the All-NF problem in output-optimal time, where is the set of substrings of S paired with their positive NF values. We note that always holds. In contrast to Guo et al.’s algorithm that is based on Ukkonen’s suffix tree construction, our algorithm is based on Weiner’s suffix tree construction.
期刊介绍:
Information Processing Letters invites submission of original research articles that focus on fundamental aspects of information processing and computing. This naturally includes work in the broadly understood field of theoretical computer science; although papers in all areas of scientific inquiry will be given consideration, provided that they describe research contributions credibly motivated by applications to computing and involve rigorous methodology. High quality experimental papers that address topics of sufficiently broad interest may also be considered.
Since its inception in 1971, Information Processing Letters has served as a forum for timely dissemination of short, concise and focused research contributions. Continuing with this tradition, and to expedite the reviewing process, manuscripts are generally limited in length to nine pages when they appear in print.