Counting distinct (non-)crossing substrings
Data Structures and Algorithms
2025-07-01 v1
Abstract
Let be a string of length . The problem of counting factors crossing a position - Problem 64 from the textbook ``125 Problems in Text Algorithms'' [Crochemore, Leqroc, and Rytter, 2021], asks to count the number (resp. ) of distinct substrings in that have occurrences containing (resp. not containing) a position in . The solutions provided in their textbook compute and in time for a single position in , and thus a direct application would require time for all positions in . Their solution is designed for constant-size alphabets. In this paper, we present new algorithms which compute in total time for general ordered alphabets, and in total time for linearly sortable alphabets, for all positions in .
Keywords
Cite
@article{arxiv.2506.22728,
title = {Counting distinct (non-)crossing substrings},
author = {Haruki Umezaki and Hiroki Shibata and Dominik Köppl and Yuto Nakashima and Shunsuke Inenaga and Hideo Bannai},
journal= {arXiv preprint arXiv:2506.22728},
year = {2025}
}