This article presents an
O
(
n
)-time algorithm called SACA-K for sorting the suffixes of an input string
T
[0,
n
-1] over an alphabet
A
[0,
K
-1]. The problem of sorting the suffixes of
T
is also known as constructing the suffix array (SA) for
T
. The theoretical memory usage of SACA-K is
n
log
K
+
n
log
n
+
K
log
n
bits. Moreover, we also have a practical implementation for SACA-K that uses
n
bytes + (
n
+ 256) words and is suitable for strings over any alphabet up to full ASCII, where a word is log
n
bits. In our experiment, SACA-K outperforms SA-IS that was previously the most time- and space-efficient linear-time SA construction algorithm (SACA). SACA-K is around 33% faster and uses a smaller deterministic workspace of
K
words, where the workspace is the space needed beyond the input string and the output SA. Given
K
=
O
(1), SACA-K runs in linear time and
O
(1) workspace. To the best of our knowledge, such a result is the first reported in the literature with a practical source code publicly available.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.