This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 373: Theory of Computation Gul Agha Mahesh Viswanathan Fall 2010 1 1 Introduction Optimal Algorithms Figure 1: Manuel Blum Best Solutions If a problem can be solved computationally, is there always a “best” method for solving it? Example 1 . ¡2¿ Merge Sort and Heap Sort achieve the assymptotically best time possible for sorting (in a certain model). Blum’s Speedup Theorem No! There are computationally solvable problems that have no optimal algorithms! In other words, there are problems for which any algorithm can always be made faster. Optimal Algorithms Regular Languages Figure 2: Anil Nerode MyhillNerode Theorem There is a “unique” “optimal” “algorithm” for every problem that can be solved using finite memory. • “algorithm” here means a deterministic machine • “optimal” means requires least memory, i.e., has fewest states • “unique” means that any two DFAs with fewest states for a language are “isomorphic” 2 1.1 Suffix Languages Suffix Language of a State q q q 00 q p 1 1 1 , 1 Figure 3: DFA M Given DFA M = ( Q, Σ ,δ,q ,F ), suffix( M,q ) = { w ∈ Σ *  ˆ δ ( q,w ) ∈ F } . In other words, it is the collection of all words accepted if q were the initial state. For example, suffix( M,q 00 ) =0 * 1(0 ∪ 1) * . Suffix Languages Definition 2. For a language L ⊆ Σ * , and a string x ∈ Σ * , the suffix language of L with respect to x , is defined as suffix( L,x ) = { y ∈ Σ *  xy ∈ L } In other words, suffix( L,x ) is the collection of strings y which when prefixed by x , result in a string in L . The class of suffix languages of L is C suf ( L ) = { suffix( L,x )  x ∈ Σ * } 1.2 Examples Example: L odd Example 3 . Consider L odd = { w ∈ { , 1 } *  w has an odd number of 1s } • suffix( L odd , ) = L odd • suffix( L odd , 0) = L odd • suffix( L odd , 1) = { w ∈ { , 1 } *  w has an even number of 1s } = L even Example: L odd Class of Suffix Languages Example 4 . Consider L odd = { w ∈ { , 1 } *  w has an odd number of 1s } 3 • For x that has an even number of 1s, suffix( L odd ,x ) = L odd • For x that has an odd number of 1s, suffix( L odd ,x ) = L even • Thus, C suf ( L odd ) = { L odd ,L even } Example: L odd DFA and Suffix Languages Example 5 . Recall, C suf ( L odd ) = { L odd ,L even } . A DFA for L odd is q q 1 1 1 Figure 4: DFA for L odd Observe that suffix( M,q ) = L odd , and suffix( M,q 1 ) = L even . Example: L 001 Example 6 . Consider L 001 = (0 ∪ 1) * 001(0 ∪ 1) * ....
View
Full
Document
This note was uploaded on 10/04/2011 for the course CS 373 taught by Professor Viswanathan,m during the Fall '08 term at University of Illinois, Urbana Champaign.
 Fall '08
 Viswanathan,M
 Algorithms

Click to edit the document details