Index
Problem list
String
Bracelet
References
TODO list
P43
: Enumeration of all $k$-ary bracelets
P43
:
Enumeration of all $k$-ary bracelets
Input:
$n$: a length of a bracelet, $k$: a number of alphabet size.
Output:
All $k$-ary bracelets.
Complexity:
$O(1)$ amortized per output and $O(n)$ space.
Comment:
A bracelet is the lexicographically smallest element of an equivalence class of $k$-ary strings under string rotation and reversal.
Reference:
[
Sawada2001
] (
Bibtex
)