A \emph{border} of a word $w$ is a word that is both a non-empty proper prefix and suffix of $w$. If $w$ has a border, then it is said to be \emph{bordered}; otherwise, it is said to be \emph{unbordered}. The main results of this paper are the first algorithms to rank and unrank length-$n$ bordered and unbordered words over a $k$-letter alphabet. We show that, under the unit-cost RAM model, ranking bordered and unbordered words can be done in $O(kn^3)$ time using $O(n)$ space, and unranking them can be done in $O(n^4k\log k)$ time using $O(n)$ space.
翻译:单词$w$的\textit{边界}是指既是其非空前缀又是非空后缀的词。若$w$存在边界,则称其为\textit{有边界的};否则称其为\textit{无边界的}。本文的主要成果是首次提出在$k$字母表上对长度为$n$的有边界和无边界单词进行排名与反排名的算法。研究表明,在单位成本RAM模型下,对有边界和无边界单词的排名可在$O(kn^3)$时间和$O(n)$空间内完成;而反排名则可在$O(n^4k\log k)$时间和$O(n)$空间内完成。