File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 10
10
* that can be obtained by rotating a string. For example, the rotation
11
11
* equivalence class of "abc" is {"abc", "bca", "cab"}. The lexicographically
12
12
* smallest string in this class is "abc".
13
- * Duval's algorithm works by finding the lexicographically smallest Lyndon word
14
- * in a string. It does this by iterating over the string and finding the
13
+ *
14
+ * Duval's algorithm works by iterating over the string and finding the
15
15
* smallest rotation of the string that is a Lyndon word. This is done by
16
16
* comparing the string with its suffixes and finding the smallest suffix that
17
17
* is lexicographically smaller than the string. This suffix is then added to
18
18
* the result and the process is repeated with the remaining string.
19
19
* The algorithm has a time complexity of O(n) where n is the length of the
20
20
* string.
21
21
*
22
- * @note While Lyndon word are described in the context of strings,
22
+ * @note While Lyndon words are described in the context of strings,
23
23
* Duval's algorithm can be used to find the lexicographically smallest cyclic
24
24
* shift of any sequence of comparable elements.
25
25
*
You can’t perform that action at this time.
0 commit comments