This commit is contained in:
Mark 2024-04-02 21:15:34 -07:00
parent 17e019fd02
commit c10ef06d85
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
5 changed files with 84 additions and 35 deletions

View File

@ -3,7 +3,7 @@
\example{}<lockproblem> \example{}<lockproblem>
A certain electronic lock has two buttons: \texttt{0} and \texttt{1}. A certain electronic lock has two buttons: \texttt{0} and \texttt{1}.
It opens as soon as the correct two-digit code is entered, completely ignoring It opens as soon as the correct two-digit code is entered, completely ignoring
previous inputs.\hspace{-0.5ex}\footnotemark{} For example, if the correct code is \text{10}, the lock will open previous inputs. For example, if the correct code is \text{10}, the lock will open
once the sequence \texttt{010} is entered. once the sequence \texttt{010} is entered.
\vspace{2mm} \vspace{2mm}
@ -19,36 +19,38 @@ Unlock this lock with only 5 keypresses.
\begin{solution} \begin{solution}
The sequence \texttt{00110} is guaranteed to unlock this lock. The sequence \texttt{00110} is guaranteed to unlock this lock.
\end{solution} \end{solution}
\vfill
Now, consider the same lock, now set with a three-digit binary code.
\problem{}
How many codes are possible?
\vfill
\problem{} \problem{}
Consider the same lock, now set with a three-digit binary code. Show that there is no solution with fewer than three keypresses
\begin{itemize} \vfill
\item How many codes are possible?
\item What is the shortest sequence that is guaranteed to unlock the lock? \par \problem{}
\hint{You'll need 10 digits.} What is the shortest sequence that is guaranteed to unlock the lock? \par
\end{itemize} \hint{You'll need 10 digits.}
\begin{solution} \begin{solution}
\begin{itemize} \texttt{0001110100} will do.
\item $2^3 = 8$
\item \texttt{0001110100} will do.
\end{itemize}
\end{solution} \end{solution}
\problem{} %\problem{}
How about a four-digit code? How many digits do we need? \par %How about a four-digit code? How many digits do we need? \par
%
\begin{instructornote} %\begin{instructornote}
Don't spend too much time here. % Don't spend too much time here.
Provide a solution at the board once everyone has had a few % Provide a solution at the board once everyone has had a few
minutes to think about this problem. % minutes to think about this problem.
\end{instructornote} %\end{instructornote}
%
\begin{solution} %\begin{solution}
One example is \texttt{0000 1111 0110 0101 000} % One example is \texttt{0000 1111 0110 0101 000}
\end{solution} %\end{solution}
\vfill \vfill
\pagebreak \pagebreak

View File

@ -2,24 +2,28 @@
\definition{} \definition{}
An \textit{alphabet} is a set of symbols. \par An \textit{alphabet} is a set of symbols. \par
For example, $\{\texttt{0}, \texttt{1}\}$ is an alphabet of two symbols, \par For example, $\{\texttt{0}, \texttt{1}\}$ is an alphabet of two symbols,
and $\{\texttt{a}, \texttt{b}, \texttt{c}\}$ is an alphabet of three. and $\{\texttt{a}, \texttt{b}, \texttt{c}\}$ is an alphabet of three.
\definition{} \definition{}
A \textit{word} over an alphabet $A$ is a sequence of symbols in that alphabet. \par A \textit{word} over an alphabet $A$ is a sequence of symbols in that alphabet. \par
For example, $\texttt{00110}$ is a word over the alphabet $\{\texttt{0}, \texttt{1}\}$. \par For example, $\texttt{00110}$ is a word over the alphabet $\{\texttt{0}, \texttt{1}\}$. \par
We'll let $\varnothing$ denote the empty word, which exists over every alphabet. We'll let $\varnothing$ denote the empty word, which is a valid word over any alphabet.
\definition{} \definition{}
Let $v$ and $w$ be words over the same alphabet. \par Let $v$ and $w$ be words over the same alphabet. \par
We say $v$ is a \textit{subword} of $w$ if $v$ is contained in $w$. \par We say $v$ is a \textit{subword} of $w$ if $v$ is contained in $w$. \par
\note{
In other words, $v$ is a subword of $w$ if we can construct $v$ \par
by removing a few characters from the start and end of $w$.
}
For example, \texttt{11} is a subword of \texttt{011}, but \texttt{00} is not. For example, \texttt{11} is a subword of \texttt{011}, but \texttt{00} is not.
\definition{} \definition{}
Recall \ref{lockproblem}. From now on, we'll call this the \textit{$n$-subword problem}: \par Recall \ref{lockproblem}. Let's generalize this to the \textit{$n$-subword problem}: \par
Given an alphabet $A$ and a positive integer $n$, Given an alphabet $A$ and a positive integer $n$,
we want a word over $A$ that contains all possible length-$n$ subwords. \par we want a word over $A$ that contains all possible length-$n$ subwords.
That shortest word that solves a given $n$-subword problem is called the \textit{optimal solution}. The shortest word that solves a given $n$-subword problem is called the \textit{optimal solution}.
@ -55,6 +59,12 @@ Find the following:
\vfill \vfill
\pagebreak \pagebreak
\problem{}<sbounds> \problem{}<sbounds>
Let $w$ be a word over an alphabet of size $k$. \par Let $w$ be a word over an alphabet of size $k$. \par
Prove the following: Prove the following:
@ -87,6 +97,10 @@ Prove the following:
\definition{} \definition{}
Let $v$ and $w$ be words over the same alphabet. \par Let $v$ and $w$ be words over the same alphabet. \par
The word $vw$ is the word formed by writing $v$ after $w$. \par The word $vw$ is the word formed by writing $v$ after $w$. \par
@ -145,6 +159,10 @@ We'll call this the \textit{Fibonacci word} of order $k$.
% C_k is called the "Champernowne word" of order k. % C_k is called the "Champernowne word" of order k.
\problem{}<cword> \problem{}<cword>
Let $C_k$ denote the word over the alphabet $\{\texttt{0}, \texttt{1}\}$ obtained by \par Let $C_k$ denote the word over the alphabet $\{\texttt{0}, \texttt{1}\}$ obtained by \par

View File

@ -27,8 +27,8 @@ and five edges (labeled $0, ... , 4$).
\end{center} \end{center}
\definition{} \definition{}
A \textit{path} in a graph is a sequence of adjacent edges. \par A \textit{path} in a graph is a sequence of adjacent edges, \par
In a directed graph, adjacent edges are those that start and end at the same node. \par In a directed graph, edges $a$ and $b$ are adjacent if $a$ ends at the node which $b$ starts at. \par
\vspace{2mm} \vspace{2mm}
For example, consider the graph above. \par For example, consider the graph above. \par
The edges $0$ and $1$ are not adjacent, because $0$ and $1$ both \textit{end} at $b$. \par The edges $0$ and $1$ are not adjacent, because $0$ and $1$ both \textit{end} at $b$. \par
@ -88,6 +88,9 @@ if any of these conditions are violated, why do we know that an Eulerian cycle (
\definition{} \definition{}
Now, consider the $n$-subword problem over $\{\texttt{0}, \texttt{1}\}$. \par Now, consider the $n$-subword problem over $\{\texttt{0}, \texttt{1}\}$. \par
We'll call the optimal solution to this problem a \textit{De Bruijn\footnotemark{} word} of order $n$. \par We'll call the optimal solution to this problem a \textit{De Bruijn\footnotemark{} word} of order $n$. \par
@ -113,7 +116,7 @@ Show that the following bounds always hold:
\remark{} \remark{}
Now, we'd like to show that the length of a De Bruijn word is always $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 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$ 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. that solves the binary $n$-subword problem.
@ -189,6 +192,16 @@ $G_2$ and $G_3$ are shown below.
\vfill \vfill
\pagebreak \pagebreak
\problem{} \problem{}
Draw $G_4$. Draw $G_4$.
@ -310,6 +323,16 @@ Find De Bruijn words of orders $2$, $3$, and $4$.
\vfill \vfill
\pagebreak \pagebreak
Let's quickly show that the process described in \ref{dbeuler} Let's quickly show that the process described in \ref{dbeuler}
indeed produces a valid De Bruijn word. indeed produces a valid De Bruijn word.

View File

@ -1,7 +1,8 @@
\section{Line Graphs} \section{Line Graphs}
\problem{} \problem{}
Given a graph $G$, we can construct its \textit{line graph} (denoted $\mathcal{L}(G)$) by doing the following: \par Given a graph $G$, we can construct a graph called the \par
\textit{line graph} of $G$ (\hspace{0.3ex}denoted $\mathcal{L}(G)$\hspace{0.3ex}) by doing the following: \par
\begin{itemize} \begin{itemize}
\item Creating a node in $\mathcal{L}(G)$ for each edge in $G$ \item Creating a node in $\mathcal{L}(G)$ for each edge in $G$
\item Drawing a directed edge between every pair of nodes $a, b$ in $\mathcal{L}(G)$ \par \item Drawing a directed edge between every pair of nodes $a, b$ in $\mathcal{L}(G)$ \par
@ -93,7 +94,11 @@ Now, relabel the edge from $a$ to $b$ as $\texttt{x}\overline{\texttt{p}}\texttt
Use these new labels to name nodes in $\mathcal{L}(G_n)$. Use these new labels to name nodes in $\mathcal{L}(G_n)$.
\problem{} \problem{}
Construct $\mathcal{L}(G_2)$ and $\mathcal{L}(G_3)$. What do you notice? Construct $\mathcal{L}(G_2)$ and $\mathcal{L}(G_3)$. What do you notice? \par
\hint{
What are $\mathcal{L}(G_2)$ and $\mathcal{L}(G_3)$? We've seen them before! \par
You may need to re-label a few edges.
}
\begin{solution} \begin{solution}
After fixing edge labels, we find that After fixing edge labels, we find that

View File

@ -275,7 +275,7 @@ Attempt the above construction a few times. Is $w$ a minimal Sturmian word?
\theorem{} \theorem{}<sturmanthm>
We can construct a miminal Sturmian word of order $n \geq 3$ as follows: We can construct a miminal Sturmian word of order $n \geq 3$ as follows:
\begin{itemize} \begin{itemize}
\item Start with $G_2$, create $R_2$ by removing one edge. \item Start with $G_2$, create $R_2$ by removing one edge.
@ -287,6 +287,7 @@ We can construct a miminal Sturmian word of order $n \geq 3$ as follows:
\item Construct a word $w$ using the Eulerian path, as before. \par \item Construct a word $w$ using the Eulerian path, as before. \par
This is a minimal Sturmian word. This is a minimal Sturmian word.
\end{itemize} \end{itemize}
For now, assume this theorem holds. We'll prove it in the next few problems.
\problem{}<sturmianfour> \problem{}<sturmianfour>
Construct a minimal Sturmain word of order 4. Construct a minimal Sturmain word of order 4.
@ -374,7 +375,7 @@ Construct a minimal Sturmain word of order 5.
\problem{} \problem{}
Argue that the words we get are mimimal Sturmain words: \par Argue that the words we get by \ref{sturmanthm} are mimimal Sturmain words. \par
That is, the word $w$ has length $2n$ and $\mathcal{S}_m(w) = m + 1$ for all $m \leq n$. That is, the word $w$ has length $2n$ and $\mathcal{S}_m(w) = m + 1$ for all $m \leq n$.
\begin{solution} \begin{solution}