Greedy Construction  Output  

Perhaps the most surprising DB sequence constructions are the greedy constructions. A greedy construction starts with a seed string, then repeatedly applies some greedy rule to determine the next symbol of a sequence. The algorithm stops when it is impossible to add another symbol without creating a duplicate substring of length $n$, or some termination condition is reached. Such constructions, however, have a major drawback: they require exponential space.
The Preferlargest [Mar34] (smallest) greedy approach does not use any information about the string currently generated to prioritize the next symbol. There are two approaches whose greedy decision is based on the last symbol generated: the Preferopposite [Alh10] and the Prefersame [EGGR58,Fre82,ASS19]. These greedy approaches can extended when the preferences are based more generally on the last $j$ symbols generated [Alh12].
The most wellknown greedy construction is the Preferlargest attributed to Martin [Mar34] which works as follows:
Note the importance of the string $0^{n1}$ to seed the algorithm. Starting with any other seed will not produce a DB sequence using this greedy approach.
The Prefersmallest is equivalent to the Preferlargest construction when the symbol 0 is replaced by $k{}1$, 1 is replaced by $k{}2$ and so on. The Prefersmallest greedy algorithm produces the lexicographically smallest DB sequence, and it can be constructed more efficiently by either a shift rule or by a concatenation approach. This sequence is also known as the Granddaddy.
The original presentations of a binary Prefersame construction (in the appendix of [EGGR58,Fre82]) required an additional counting test for certain substrings. However, when seeded with an appropriate string, these tests are not required [ASS19].
The resulting sequence has the interesting property that it is the lexicographically largest with respect to a runlength encoding. Note that the this holds even when the roles of the 0 and 1 are interchanged. The Prefersame sequence can also be constructed efficiently in $O(n)$ time per bit via a shift rule (coming soon). This construction can be generalized to a larger alphabet of size $k$ by letting the preference order for the last symbol $s$ be: $s, s{+}1, \ldots, k{}1, 0, 1, \ldots s{}1$. The seed becomes the length $n1$ string $\cdots (k{}1)\cdots 210(k{}1)\cdots 210$.
The Preferopposite approach presented below is slightly different than its initial presentation in [Alh10]; here, the initial seed of $0^{n1}$ is rotated to the end so the resulting sequence is the lexicographically smallest with respect to a runlength endcoding [ASS19].
The Preferopposite sequence can also be constructed efficiently in $O(n)$ time per bit via a shift rule (coming soon). To generalize this construction to a larger alphabet size $k$, a valid preference order for the last sybmol $s$ is: $s{+}1, \ldots, k{}1, 0, 1, \ldots, s$ where the string $(k{}1)(k{}2)^n \cdots 2^n1^n0^{n1}$ is appended to the end instead of $10^{n1}$ when the length $n{}1$ suffix $(k{1})^{n1}$ is reached. Try it out above!