CS 374
Lab 17 April 3
Spring 2015
1. Design a one-tape TM that computes the function f (x) = 2x. More specically, when started
in the initial state scanning the rst 0 in a block of x consecutive 0s (i
CS 374
Lab 16 April 1
Spring 2015
Suppose we are given both an undirected graph G with weighted edges and a minimum spanning tree T
of G.
1. Describe an efcient algorithm to update the minimum spannin
CS 374
Lab 6 February 11
Spring 2015
Give context-free grammars for each of the following languages. For each grammar, describe in English
the language for each non-terminal, and in the examples above
CS 374
Lab 5 February 6
Spring 2015
Prove that each of the following languages is not regular.
1. Binary palindromes: Strings over cfw_0, 1 that are equal to their reversals. For example: 00111100
and
CS 374
Lab 2 January 28
Spring 2015
This lab gives practice at constructing DFAs.
1. Design a DFA that accepts all strings over the alphabet cfw_$,0,1,2,3,4,5,6,7,8,9,. that correspond
to valid curren
CS 374
Lab 0 January 21
Spring 2015
1. Suppose you have a rectangular bar of chocolate, which has been scored into an n m grid of
squares. Consider breaking the chocolate into squares in the following
Turing Machines & Computability
Course Trajectory
Seen lots of algorithms, what can be done.
Interested in limita2ons (algorithmic; @me)
Need more precise [email protected] of
Algorithms
Lecture 20: Minimum Spanning Trees [Fa14]
We must all hang together, gentlemen, or else we shall most assuredly hang
separately.
Benjamin Franklin, at the signing of the
Declaration of Ind
CS 374: Algorithms & Models of Computation,
Spring 2015
Greedy Algorithms for
Minimum Spanning Trees
Lecture 18
March 31, 2015
Chandra & Lenny (UIUC)
CS374
1
Spring 2015
1 / 61
Part I
Greedy Algorithm
CS 374: Algorithms & Models of Computation,
Spring 2015
Dynamic Programming:
Shortest Paths and DFA to
Reg Exps
Lecture 16
March 17, 2015
Chandra & Lenny (UIUC)
CS374
1
Spring 2015
1 / 54
Part I
Short
Nondeterminis+c Finite Automata
DFA Reminder
A DFA is a quintuple M=(Q,q0,F), where:
Q is a nite set of states
is a nite alphabet of symbols
: Q x Q is a
Strings, Languages, and
Regular expressions
Deni&ons for strings
= nite alphabet of symbols
= cfw_0,1, or =cfw_a,b,c,.,z, or =all ascii characters
string or wor
Determinis)c Finite Automata
DFAs (also called FSMs)
A simple(st?) model of what a computer is
Many devices modeled, programmed as DFAs
Vending machines
Elevators
Regular Expressions & Automata
Regular Language Equivalence Thm
Languages captured by DFAs, NFAs, and regular
expressions are the same.
DFAs
Proof:
NFAs
today
regular
Closure Proper+es
of Regular Languages
Closure proper*es
In general, if S is a set, and foo() is a binary
operator dened on elements of S, then we
say S is closed
CS 374
Lab 3 January 30
Spring 2015
This lab gives practice at constructing NFAs and understanding their power and exibility.
1. Design an NFA for the set of strings that consist of 01 repeated one or
CS 374
Lab 1 January 23
Spring 2015
This lab is about strings and regular expressions. Recall the denition and properties of the
concatenation operator between strings.
Lemma 1: Concatenating nothing