Computing palindromes on a trie in linear time

11/08/2022
βˆ™
by   Takuya Mieno, et al.
βˆ™
0
βˆ™

A trie 𝒯 is a rooted tree such that each edge is labeled by a single character from the alphabet, and the labels of out-going edges from the same node are mutually distinct. Given a trie 𝒯 with n edges, we show how to compute all distinct palindromes and all maximal palindromes on 𝒯 in O(n) time, in the case of integer alphabets of size polynomial in n. This improves the state-of-the-art O(n log h)-time algorithms by Funakoshi et al. [PCS 2019], where h is the height of 𝒯. Using our new algorithms, the eertree with suffix links for a given trie 𝒯 can readily be obtained in O(n) time. Further, our trie-based O(n)-space data structure allows us to report all distinct palindromes and maximal palindromes in a query string represented in the trie 𝒯, in output optimal time. This is an improvement over an existing (naΓ―ve) solution that precomputes and stores all distinct palindromes and maximal palindromes for each and every string in the trie 𝒯 separately, using a total O(n^2) preprocessing time and space, and reports them in output optimal time upon query.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
βˆ™ 06/01/2018

Block Palindromes: A New Generalization of Palindromes

We propose a new generalization of palindromes and gapped palindromes ca...
research
βˆ™ 07/20/2023

Efficient algorithms for enumerating maximal common subsequences of two strings

We propose efficient algorithms for enumerating maximal common subsequen...
research
βˆ™ 01/30/2019

Computing runs on a trie

A maximal repeat, or run, in a string, is a periodically maximal substri...
research
βˆ™ 12/15/2017

Optimal top dag compression

It is shown that for a given ordered node-labelled tree of size n and wi...
research
βˆ™ 10/05/2022

Computing maximal generalized palindromes

Palindromes are popular and important objects in textual data processing...
research
βˆ™ 08/08/2023

Linear Time Construction of Cover Suffix Tree and Applications

The Cover Suffix Tree (CST) of a string T is the suffix tree of T with a...
research
βˆ™ 07/09/2022

Online algorithms for finding distinct substrings with length and multiple prefix and suffix conditions

Let two static sequences of strings P and S, representing prefix and suf...

Please sign up or login with your details

Forgot password? Click here to reset