Due Date: Feb 19, 2016
Be sure to follow the homework guidelines.
We will assume ASCII encoding for characters. Write two python functions shortlex_less
and dict_less
, each taking two parameters, such that
shortlex_less(s, t)
returnsTrue
if strings
precedes stringt
in shortlex order and returnsFalse
otherwise.
dict_less(s, t)
returnsTrue
if strings
precedes stringt
in dictionary order and returnsFalse
otherwise.
Email the source code for your functions as one text file to .
Do Exercise 1.3 on page 83.
Do Exercise 1.4(c) on page 83 as follows.
- Draw a transition diagram of a DFA that recognizes the language
{
w
:w
has an even number ofa
's }.
- Draw a transition diagram of a DFA that recognizes the language
{
w
:w
has one or twob
's }.
- Use product construction to combine the two machines above into one that recognizes the language
{
w
:w
has an even number ofa
's and one or twob
's }.
Do Exercise 1.5(c) on page 84.
Do Exercise 1.6 (e) on page 84.
Do Exercise 1.6 (j) on page 84.
(Extra credit) Do Problems 1.32 and 1.33 on page 88 and 89, or Problem 1.37 on page 89.