Tight Tradeoffs for Real-Time Approximation of Longest Palindromes in Streams

Authors Pawel Gawrychowski, Oleg Merkurev, Arseny Shur, Przemyslaw Uznanski

Thumbnail PDF


  • Filesize: 488 kB
  • 13 pages

Document Identifiers

Author Details

Pawel Gawrychowski
Oleg Merkurev
Arseny Shur
Przemyslaw Uznanski

Cite AsGet BibTex

Pawel Gawrychowski, Oleg Merkurev, Arseny Shur, and Przemyslaw Uznanski. Tight Tradeoffs for Real-Time Approximation of Longest Palindromes in Streams. In 27th Annual Symposium on Combinatorial Pattern Matching (CPM 2016). Leibniz International Proceedings in Informatics (LIPIcs), Volume 54, pp. 18:1-18:13, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2016)


We consider computing a longest palindrome in the streaming model, where the symbols arrive one-by-one and we do not have random access to the input. While computing the answer exactly using sublinear space is not possible in such a setting, one can still hope for a good approximation guarantee. Our contribution is twofold. First, we provide lower bounds on the space requirements for randomized approximation algorithms processing inputs of length n. We rule out Las Vegas algorithms, as they cannot achieve sublinear space complexity. For Monte Carlo algorithms, we prove a lower bounds of Omega(M log min {|Sigma|, M}) bits of memory; here M=n/E for approximating the answer with additive error E, and M= log n / log (1 + epsilon) for approximating the answer with multiplicative error (1 + epsilon). Second, we design three real-time algorithms for this problem. Our Monte Carlo approximation algorithms for both additive and multiplicative versions of the problem use O(M) words of memory. Thus the obtained lower bounds are asymptotically tight up to a logarithmic factor. The third algorithm is deterministic and finds a longest palindrome exactly if it is short. This algorithm can be run in parallel with a Monte Carlo algorithm to obtain better results in practice. Overall, both the time and space complexity of finding a longest palindrome in a stream are essentially settled.
  • streaming algorithms
  • space lower bounds
  • real-time algorithms
  • palin- dromes
  • Monte Carlo algorithms


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. A. Apostolico, D. Breslauer, and Z. Galil. Parallel detection of all palindromes in a string. Theoret. Comput. Sci., 141:163-173, 1995. Google Scholar
  2. P. Berenbrink, F. Ergün, F. Mallmann-Trenn, and E. Sadeqi Azer. Palindrome recognition in the streaming model. In STACS 2014, volume 25 of LIPIcs, pages 149-161, 2014. Google Scholar
  3. D. Breslauer and Z. Galil. Real-time streaming string-matching. In CPM 2011, volume 6661 of LNCS, pages 162-172. Springer, 2011. Google Scholar
  4. Raphaël Clifford, Allyx Fontaine, Ely Porat, Benjamin Sach, and Tatiana A. Starikovskaya. Dictionary matching in a stream. In ESA 2015, volume 9294 of LNCS, pages 361-372. Springer, 2015. Google Scholar
  5. Raphaël Clifford, Allyx Fontaine, Ely Porat, Benjamin Sach, and Tatiana A. Starikovskaya. The k-mismatch problem revisited. In SODA 2016, pages 2039-2052. SIAM, 2016. Google Scholar
  6. Funda Ergün, Hossein Jowhari, and Mert Saglam. Periodicity in streams. In RANDOM 2010, volume 6302 of LNCS, pages 545-559. Springer, 2010. Google Scholar
  7. Z. Galil and J. Seiferas. A linear-time on-line recognition algorithm for "Palstar". J. ACM, 25:102-111, 1978. Google Scholar
  8. Paweł Gawrychowski, Florin Manea, and Dirk Nowotka. Testing Generalised Freeness of Words. In STACS 2014, LIPIcs, pages 337-349, 2014. Google Scholar
  9. Markus Jalsenius, Benny Porat, and Benjamin Sach. Parameterized matching in the streaming model. In STACS 2015, LIPIcs, pages 400-411, 2013. Google Scholar
  10. R. Karp and M. Rabin. Efficient randomized pattern matching algorithms. IBM Journal of Research and Development, 31:249-260, 1987. Google Scholar
  11. D. E. Knuth, J. Morris, and V. Pratt. Fast pattern matching in strings. SIAM J. Comput., 6:323-350, 1977. Google Scholar
  12. G. Manacher. A new linear-time on-line algorithm finding the smallest initial palindrome of a string. J. ACM, 22(3):346-351, 1975. Google Scholar
  13. B. Porat and E. Porat. Exact and approximate pattern matching in the streaming model. In FOCS 2009, pages 315-323. IEEE Computer Society, 2009. Google Scholar
  14. M. Rubinchik and A. M. Shur. The number of distinct subpalindromes in random words. arXiv:1505.08043 [math.CO], 2015. Google Scholar
  15. Andrew Chi-Chih Yao. Probabilistic computations: Toward a unified measure of complexity (extended abstract). In FOCS 1977, pages 222-227. IEEE Computer Society, 1977. Google Scholar
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail