English

A Note on the Longest Common Compatible Prefix Problem for Partial Words

Data Structures and Algorithms 2013-12-10 v1 Formal Languages and Automata Theory

Abstract

For a partial word ww the longest common compatible prefix of two positions i,ji,j, denoted lccp(i,j)lccp(i,j), is the largest kk such that w[i,i+k1]w[j,j+k1]w[i,i+k-1]\uparrow w[j,j+k-1], where \uparrow is the compatibility relation of partial words (it is not an equivalence relation). The LCCP problem is to preprocess a partial word in such a way that any query lccp(i,j)lccp(i,j) about this word can be answered in O(1)O(1) time. It is a natural generalization of the longest common prefix (LCP) problem for regular words, for which an O(n)O(n) preprocessing time and O(1)O(1) query time solution exists. Recently an efficient algorithm for this problem has been given by F. Blanchet-Sadri and J. Lazarow (LATA 2013). The preprocessing time was O(nh+n)O(nh+n), where hh is the number of "holes" in ww. The algorithm was designed for partial words over a constant alphabet and was quite involved. We present a simple solution to this problem with slightly better runtime that works for any linearly-sortable alphabet. Our preprocessing is in time O(nμ+n)O(n\mu+n), where μ\mu is the number of blocks of holes in ww. Our algorithm uses ideas from alignment algorithms and dynamic programming.

Keywords

Cite

@article{arxiv.1312.2381,
  title  = {A Note on the Longest Common Compatible Prefix Problem for Partial Words},
  author = {Maxime Crochemore and Costas S. Iliopoulos and Tomasz Kociumaka and Marcin Kubica and Alessio Langiu and Jakub Radoszewski and Wojciech Rytter and Bartosz Szreder and Tomasz Waleń},
  journal= {arXiv preprint arXiv:1312.2381},
  year   = {2013}
}
R2 v1 2026-06-22T02:23:36.300Z