Saved in:
| Main Authors: | , |
|---|---|
| Format: | Preprint |
| Published: |
2025
|
| Subjects: | |
| Online Access: | https://arxiv.org/abs/2506.06452 |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
| _version_ | 1866911361655635968 |
|---|---|
| author | Jain, Samkith K Mhaskar, Neerja |
| author_facet | Jain, Samkith K Mhaskar, Neerja |
| contents | A closed string $u$ is either of length one or contains a border that occurs only as a prefix and as a suffix in $u$ and nowhere else within $u$. In this paper, we present fast $\mathcal{O}(n\log n)$ time algorithms to compute all $\mathcal{O}(n^2)$ closed substrings by introducing a compact representation for all closed substrings of a string $ w[1..n]$, using only $\mathcal{O}(n \log n)$ space. These simple and space-efficient algorithms also compute maximal closed strings. Furthermore, we compare the performance of these algorithms and identify classes of strings where each performs best. Finally, we show that the exact number of MCSs ($M(f_n)$) in a Fibonacci word $ f_n $, for $n \geq 5$, is $\approx \left(1 + \frac{1}{ϕ^2}\right) F_n \approx 1.382 F_n$, where $ ϕ$ is the golden ratio. |
| format | Preprint |
| id |
arxiv_https___arxiv_org_abs_2506_06452 |
| institution | arXiv |
| publishDate | 2025 |
| record_format | arxiv |
| spellingShingle | Efficient Algorithms to Compute Closed Substrings Jain, Samkith K Mhaskar, Neerja Data Structures and Algorithms A closed string $u$ is either of length one or contains a border that occurs only as a prefix and as a suffix in $u$ and nowhere else within $u$. In this paper, we present fast $\mathcal{O}(n\log n)$ time algorithms to compute all $\mathcal{O}(n^2)$ closed substrings by introducing a compact representation for all closed substrings of a string $ w[1..n]$, using only $\mathcal{O}(n \log n)$ space. These simple and space-efficient algorithms also compute maximal closed strings. Furthermore, we compare the performance of these algorithms and identify classes of strings where each performs best. Finally, we show that the exact number of MCSs ($M(f_n)$) in a Fibonacci word $ f_n $, for $n \geq 5$, is $\approx \left(1 + \frac{1}{ϕ^2}\right) F_n \approx 1.382 F_n$, where $ ϕ$ is the golden ratio. |
| title | Efficient Algorithms to Compute Closed Substrings |
| topic | Data Structures and Algorithms |
| url | https://arxiv.org/abs/2506.06452 |