Abstract
A (finite) Fibonacci string F n is defined as follows: F 0 = b, F 1 = a; for every integer n ⩾ 2, F n = F n − 1 F n − 2 . For n ⩾ 1, the length of F n is denoted by ƒ n = ¦F n¦ . The infinite Fibonacci string F is the string which contains every F n , n ⩾ 1, as a prefix. Apart from their general theoretical importance, Fibonacci strings are often cited as worst-case examples for algorithms which compute all the repetitions or all the “Abelian squares” in a given string. In this paper we provide a characterization of all the squares in F, hence in every prefix F n ; this characterization naturally gives rise to a Θ(ƒ n) algorithm which specifies all the squares of F n in an appropriate encoding. This encoding is made possible by the fact that the squares of F n occur consecutively, in “runs”, the number of which is Θ(ƒ n) . By contrast, the known general algorithms for the computation of the repetitions in an arbitrary string require Θ(ƒ n log ƒ n) time (and produce Θ(ƒ n log ƒ n) outputs) when applied to a Fibonacci string F n .
Published Version
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have