Shortest Covers of All Cyclic Shifts of a String. A factor W of a string X is called a cover of X, if X can be constructed by concatenations and superpositions of W. Breslauer (IPL, 1992) proposed a wellknown (mathcal O(n))time algorithm that computes the shortest cover of every prefix of a string of length n. We show an (mathcal O(n log n))time algorithm that computes the shortest cover of every cyclic shift of a string and an (mathcal O(n))time algorithm that computes the shortest among these covers. A related problem is the number of different lengths of shortest covers of cyclic shifts of the same string of length n. We show that this number is (varOmega (log n)).

Regular Languages meet Prefix Sorting. Indexing strings via prefix (or suffix) sorting is, arguably, one of the most successful algorithmic techniques developed in the last decades. Can indexing be extended to languages? The main contribution of this paper is to initiate the study of the subclass of regular languages accepted by an automaton whose states can be prefixsorted. Starting from the recent notion of Wheeler graph Gagie et al., TCS 2017which extends naturally the concept of prefix sorting to labeled graphswe investigate the properties of Wheeler languages, that is, regular languages admitting an accepting Wheeler finite automaton. Interestingly, we characterize this family as the natural extension of regular languages endowed with the colexicographic ordering: when sorted, the strings belonging to a Wheeler language are partitioned into a finite number of colexicographic intervals, each formed by elements from a single MyhillNerode equivalence class. Moreover: (i) We show that every Wheeler NFA (WNFA) with n states admits an equivalent Wheeler DFA (WDFA) with at most 2n1Sigma states that can be computed in O(n3) time. This is in sharp contrast with general NFAs. (ii) We describe a quadratic algorithm to prefixsort a proper superset of the WDFAs, a O(nlog n)time online algorithm to sort acyclic WDFAs, and an optimal lineartime offline algorithm to sort general WDFAs. By contribution (i), our algorithms can also be used to index any WNFA at the moderate price of doubling the automatonu0027s size. (iii) We provide a minimization theorem that characterizes the smallest WDFA recognizing the same language of any input WDFA. The corresponding constructive algorithm runs in optimal linear time in the acyclic case, and in O(nlog n) time in the general case. (iv) We show how to compute the smallest WDFA equivalent to any acyclic DFA in nearlyoptimal time.