diff --git a/Advanced/De Bruijn/parts/1 words.tex b/Advanced/De Bruijn/parts/1 words.tex index ceb5048..a4a27cd 100644 --- a/Advanced/De Bruijn/parts/1 words.tex +++ b/Advanced/De Bruijn/parts/1 words.tex @@ -17,9 +17,9 @@ For example, \texttt{11} is a subword of \texttt{011}, but \texttt{00} is not. \definition{} Recall \ref{lockproblem}. From now on, we'll call this the \textit{$n$-subword problem}: \par -Given an alphabet $A$ and a positive integer $n$, we want a \par -word over $A$ that contains all possible length-$n$ subwords. \par -The shortest word that solves a given $n$-subword problem is called the \textit{optimal solution}. +Given an alphabet $A$ and a positive integer $n$, +we want a word over $A$ that contains all possible length-$n$ subwords. \par +That shortest word that solves a given $n$-subword problem is called the \textit{optimal solution}. @@ -55,7 +55,7 @@ Find the following: \vfill \pagebreak -\problem{} +\problem{} Let $w$ be a word over an alphabet of size $k$. \par Prove the following: \begin{itemize} @@ -148,7 +148,7 @@ We'll call this the \textit{Fibonacci word} of order $k$. % C_k is called the "Champernowne word" of order k. \problem{} Let $C_k$ denote the word over the alphabet $\{\texttt{0}, \texttt{1}\}$ obtained by \par -concatenating the binary representations of the integers $0,~...,~2^k -1$.\par +concatenating the binary representations of the integers $0,~...,~2^k -1$. \par For example, $C_1 = \texttt{0}$, $C_2 = \texttt{011011}$, and $C_3 = \texttt{011011100101110111}$. \begin{itemize} \item How many symbols does the word $C_k$ contain? diff --git a/Advanced/De Bruijn/parts/2 bruijn.tex b/Advanced/De Bruijn/parts/2 bruijn.tex index f8ef734..25dafe6 100644 --- a/Advanced/De Bruijn/parts/2 bruijn.tex +++ b/Advanced/De Bruijn/parts/2 bruijn.tex @@ -96,11 +96,11 @@ We'll call the optimal solution to this problem a \textit{De Bruijn\footnotemark \problem{} -Let $\mathcal{B}_n$ be the length of an order-$n$ De Bruijn word. \par +Let $w$ be the an order-$n$ De Bruijn word, and denote its length with $|w|$. \par Show that the following bounds always hold: \begin{itemize} - \item $\mathcal{B}_n \leq n2^n$ - \item $\mathcal{B}_n \geq 2^n + n - 1$ + \item $|w| \leq n2^n$ + \item $|w| \geq 2^n + n - 1$ \end{itemize} \begin{solution} @@ -113,7 +113,7 @@ Show that the following bounds always hold: \remark{} -Now, we'd like to show that $\mathcal{B}_n = 2^n + n - 1$... \par +Now, we'd like to show that the length of a De Bruijn word is always $2^n + n - 1$... \par That is, that the optimal solution to the subword problem always has $2^n + n - 1$ letters. \par We'll do this by construction: for a given $n$, we want to build a word with length $2^n + n - 1$ that solves the binary $n$-subword problem. @@ -244,7 +244,7 @@ Draw $G_4$. \end{solution} \vfill - +\pagebreak \problem{} \begin{itemize} @@ -268,8 +268,6 @@ Show that $G_4$ always contains an Eulerian path. \par \hint{\ref{eulerexists}} \vfill -\pagebreak - \theorem{} We can now easily construct De Bruijn words for a given $n$: \par @@ -310,6 +308,7 @@ Find De Bruijn words of orders $2$, $3$, and $4$. \end{solution} \vfill +\pagebreak Let's quickly show that the process described in \ref{dbeuler} indeed produces a valid De Bruijn word. @@ -334,7 +333,17 @@ contains every possible length-$n$ subword. \par In other words, show that $\mathcal{S}_n(w) = 2^n$ for a generated word $w$. \begin{solution} - TODO + Any length-$n$ subword of $w$ is the concatenation of a vertex label and an edge label. + By construction, the next length-$n$ subword is the concatenation of the next vertex and edge + in the Eulerian cycle. + + \vspace{2mm} + + This cycle traverses each edge exactly once, so each length-$n$ subword is distinct. \par + Since $w$ has length $2^n + n - 1$, there are $2^n$ total subwords. \par + These are all different, so $\mathcal{S}_n \geq 2^n$. \par + However, $\mathcal{S}_n \leq 2^n$ by \ref{sbounds}, so $\mathcal{S}_n = 2^n$. + \end{solution} \vfill