Dynamic Programming. Shuang Zhao. Microsoft Research Asia September 5, Dynamic Programming. Shuang Zhao. Outline. Introduction.
|
|
- Winfred Rich
- 6 years ago
- Views:
Transcription
1 Microsoft Research Asia September 5, 2005
2
3 Section I
4 What is? Definition is a technique for efficiently recurrence computing by storing partial results. In this slides, I will NOT use too many formal words, but only look on some interesting problems.
5 The Longest Ascending Subsequence P : a 1, a 2,..., a n. Q : a b1, a b2,..., a bk, satisfying and 1 b 1 < b 2 <... < b k n a b1 < a b2 <... < a bk We say Q is an ascending subsequence of P. Your task is: given a sequence P, find the length its longest ascending subsequence (LAS).
6 The Longest Ascending Subsequence We use f i to denote the length of P s LAS ending with element a i. Let a 0 :=, f 0 := 0. Then we have f k = max 0 i<k {f i + 1 : a i < a k }, Hence the length of P s LAS is max{f i }. 1 k n This naive algorithm runs in O(n 2 ) time, and later we will look on this problem again.
7 The Shortest Hamilton Path Given a connected graph G(V, E) and a vertex s V. Given a weight function w over E, denoting the lengths of edges. Your task is to find the length of shortest Hamilton path starting from s.
8 The Shortest Hamilton Path This problem is N P-hard. When V is small, one FAST algorithm to solve this problem is. Use f i,s where i V, S S to denote the length of shortest Hamilton path over S, which ending at vertex i. Then min i V { fi,s } is what we want, and f i,s = min j S { fj,s {i} + w(j, i) } This algorithm runs in O( V 2 2 V ) time.
9 Section II
10 Problem I
11 The Problem: There is a board with N rows and 6 columns. How many ways can we cover the board with L pieces? One way to solve this problem, is. But where are the partial results?
12 This is a pattern, say P n,(101011)2 :
13 And by completely covering the last row of P n,(101011)2, we can obtain P n+1,(110110)2 and P n+1,(111100)2.
14 Observation For any pattern P i,j, after covering its (i + 1)-th row, we can only get patterns with the form of P i+1,j. We call P i+1,j can be generated from P i,j, denoting as P i+1,j P i,j.
15 Observation For any given covering of the N 6 board and an integer i (0 i < N), there will be one and only one pattern P i,j, which is contained in the covering. i := 4
16 The partial results are: Let f i,j to be the number of ways to cover pattern P i,j. And f i,j = f i,j = { 1 j = 0 0 otherwise P i,j P i 1,j f i 1,j i = 0 0 < i < n Finally f n 1,(111111)2 is the answer to this problem. By a coarse calculation, we know this algorithm runs in O(2 6 N 4 6 ) = O(N) time.
17 Problem II
18 The Problem: Given an alphabet Σ, a set of strings S f Σ, and an integer n. Your task is to count the number of n-length-strings which contain at least one string in S as its substring.
19 Let Σ := {a, b, c}, S := {ab} and n := 3. Then we have: aab aba abb abc bab cab One method to solve this problem is using the inclusion and exclusion theorem. But the time complexity of this method is quite high (at least O(2 S )).
20 Definition Let and be two binary relations over Σ : x y x is a prefix of y x y x is a suffix of y Definition We define the prefix set of S (S ) by pre(s) := { s : ( s S)(s s) } Obviously, S pre(s).
21 For instance, let Σ := {a, b, c} and S := {aa, ba, cba}, then pre(s) = {ε, a, aa, b, ba, c, cb, cba}
22 Let pre(s) = {s 0, s 1,..., s t } where s 0 = ε. Let F i (i = 0, 1,..., t) be the subset of Σ, satisfying for all s F i : s i s ( s s )[( r S)(r s )] s j (s i s j s j s )
23 Observation Given p Σ, for all s F i, there will be exact one j (0 j t) satisfying s p F j. We say F i F j.
24 Define f i,j by the number of i-length strings in F j. The we have f i,j = F j F k f i 1,k and the number of strings which contain at least one string in S as their substring is n f i,j Σ n i i=1 s j S
25 A brute-force approach to determine the binary relation takes O( pre(s) Σ L) O(L 2 ) where L is the total length of strings in pre(s). The time complexity of doing the is O(n pre(s) Σ ) O(n pre(s) ) O(n L).
26 Section III
27 Speed up partial results calculation
28 Speed up partial results calculation Longest Ascending Subsequence (LAS) problem revisited: The naive algorithm runs in O(n 2 ) time. Can we solve this problem more efficiently?
29 Speed up partial results calculation Let n := 6, {a n } := {5, 1, 6, 2, 4, 1.5}: Vertices, Contours Red 1, Green 2, Blue 3, etc.
30 Speed up partial results calculation Proposition The contours will NOT intersect. Proof. Assume two contours with levels i and j (i < j) intersects. Then it holds that at least one vertex of level j is below contours i. This gives the contradiction that one vertex of level i is below contours i.
31 Speed up partial results calculation {a n } = {5}
32 Speed up partial results calculation {a n } = {5, 1}
33 Speed up partial results calculation {a n } = {5, 1, 6}
34 Speed up partial results calculation {a n } = {5, 1, 6, 2}
35 Speed up partial results calculation {a n } = {5, 1, 6, 2, 4}
36 Speed up partial results calculation {a n } = {5, 1, 6, 2, 4, 1.5}
37 Speed up partial results calculation How to update the contours?
38 Speed up partial results calculation How to update the contours? 1 When the new vertex is above all contours Then a new contour is created.
39 Speed up partial results calculation How to update the contours? 2 When the new vertex is below some contour Then the contour immediately above the new vertex, is lowered.
40 Speed up partial results calculation How to update the contours? 3 When the new vertex is just on some contour Then the contours remain the same.
41 Speed up partial results calculation Find the contour immediately above the new vertex A brute-force approach runs in O(n) time. A Binary Search algorithm takes only O(log n) time. So by using Binary Search, the time complexity of entry algorithm is reduced to O(n log n).
42 Speed up partial results calculation Further thinking How to implement this algorithm? How to find the longest non-descending subsequence of a given sequence? If we given a weight to every number in the sequence, how to find the ascending subsequence which maximizes the sum of weights?
43 Speed up by monotonicity
44 Speed up by monotonicity The Optimal Binary Search Tree (OBST) Problem n numbers a 1 < a 2 <... < a n n weights w 1, w 2,..., w n 0 Construct a binary search tree using a 1,..., a n. Cost = n w i d i i=1 Your task is to find a binary search tree which minimizes the cost.
45 Speed up by monotonicity Let n := 5 and {w n } := {1, 2, 2, 3, 1}. The cost of OBST is 18.
46 Speed up by monotonicity The naive approach f i,j : The cost of OBST constructed by w i, w i+1,..., w j Then f i,j = 0 (i > j) f i,j = min {f i,k 1 + f k+1,j } + w t (i j) i k j The answer is f 1,n. The time complexity is O(n 3 ). How to speed up this algorithm? i t j
47 Speed up by monotonicity Definition For a given m n matrix A, if for all i 1 i 2 j 1 j 2, it holds A[i 1, j 1 ] + A[i 2, j 2 ] A[i 1, j 2 ] + A[i 2, j 1 ] then we say A is totally monotonic.
48 Speed up by monotonicity The inequality A[i 1, j 1 ] + A[i 2, j 2 ] A[i 1, j 2 ] + A[i 2, j 1 ] is called Quadrangle Inequality. j j 2 A 12 A 22 j 1 A 11 A 21 i 1 i 2 i
49 Speed up by monotonicity Recurrent formula of OBST problem f i,j = 0 (i > j) f i,j = min {f i,k 1 + f k+1,j } + w t (i j) i k j Define F, W R n n + by Then when i j F [i, j] := f i,j i t j W [i, j] := i k j w k F [i, j] = min {F [i, k 1] + F [k + 1, j]} + W [i, j] i k j
50 Speed up by monotonicity Proposition Matrix W is totally monotonic. Proof. For all i 1 i 2 < j 1 j 2, W [i 1, j 1 ] + W [i 2, j 2 ] = W [i 1, j 2 ] + W [i 2, j 1 ] i 1 i 2 j 1 j 2
51 Speed up by monotonicity Proposition Matrix F is also totally monotonic. This can be proved by induction on j 2 i 1. To see the details, read in the section.
52 Speed up by monotonicity Definition For all 1 i j n, define s(i, j) by s(i, j) := max i k j { k : F [i, j] = F [i, k 1] + F [k + 1, j] + W [i, j] }
53 Speed up by monotonicity Proposition s(i, j) is monotonic, namely for all 1 i j < n, s(i, j) s(i, j + 1) s(i + 1, j + 1) To see the proof, read in the section.
54 Speed up by monotonicity The new recurrent formula f i,j = min {f i,k 1 + f k+1,j } + s(i,j 1) k s(i+1,j) The time complexity to solve it is O(n 2 ). i t j w t (i j)
55
56 (In the OBST problem) Proposition Matrix F is also totally monotonic. Proof (Part 1). When i 1 = i 2 or j 1 = j 2 the Quadrangle Inequality holds.
57 Proof (Part 2). When i 1 < i 2 = j 1 < j 2, we prove by induction on j 2 i 1. Let F [i 1, j 2 ] = F [i 1, k 1] + F [k + 1, j 2 ] + W [i 1, j 2 ] Without loss of generality, k j 1.
58 Case 1. k < j 1 (= i 2 ) F [i 1, j 1 ] + F [i 2, j 2 ] F [i 1, k 1] + F [k + 1, j 1 ] + W [i 1, j 1 ] + F [i 2, j 2 ] F [i 1, k 1] + W [i 1, j 1 ] + F [k + 1, j 2 ] + F [i 2, j 1 ] F [i 1, k 1] + W [i 1, j 2 ] + F [k + 1, j 2 ] + F [i 2, j 1 ] = F [i 1, j 2 ] + F [i 2, j 1 ]
59 Case 2. k = j 1 (= i 2 ) F [i 1, j 1 ] + F [i 2, j 2 ] F [i 1, k 1] + W [i 1, j 1 ] + F [i 2, j 2 ] F [i 1, k 1] + W [i 1, j 1 ] + F [j 1 + 1, j 2 ] + W [i 2, j 2 ] = F [i 1, k 1] + W [i 1, j 2 ] + F [k + 1, j 2 ] + W [i 2, j 1 ] = F [i 1, j 2 ] + F [i 2, j 1 ]
60 Proof (Part 3). When i 1 < i 2 < j 1 < j 2, we prove by induction on j 2 i 1. Let F [i 2, j 1 ] = F [i 2, k 1] + F [k + 1, j 1 ] + W [i 2, j 1 ] F [i 1, j 2 ] = F [i 1, t 1] + F [t + 1, j 2 ] + W [i 1, j 2 ] Without loss of generality, t k. Hence i 1 t k j 1.
61 Then we have F [i 1, j 1 ] + F [i 2, j 2 ] F [i 1, t 1] + F [t + 1, j 1 ] + W [i 1, j 1 ] + F [i 2, k 1] + F [k + 1, j 2 ] + W [i 2, j 2 ] F [i 1, t 1] + F [t + 1, j 2 ] + W [i 1, j 2 ] + F [i 2, k 1] + F [k + 1, j 1 ] + W [i 2, j 1 ] = F [i 1, j 2 ] + F [i 2, j 1 ]
62 (In the OBST problem) Proposition s(i, j) is monotonic, namely for all 1 i j < n, s(i, j) s(i, j + 1) s(i + 1, j + 1) Proof. By symmetry, we need only to prove that s(i, j) s(i, j + 1). When i = j, s(i, j) = i s(i, j + 1).
63 Next we assume i < j. For convenience, we use symbol F k [i, j] to be the short from of F [i, k 1] + F [k + 1, j] + W [i, j]. So F s(i,j) [i, j] = F [i, j]. Since matrix F is totally monotonic, for all k k j, F [k + 1, j] + F [k + 1, j + 1] F [k + 1, j] + F [k + 1, j + 1]
64 Thus F [i, k 1] + F [k + 1, j] + W [i, j] + F [i, k 1] + F [k + 1, j + 1] + W [i, j + 1] F [i, k 1] + F [k + 1, j + 1] + W [i, j + 1] + F [i, k 1] + F [k + 1, j] + W [i, j] namely F k [i, j] + F k [i, j + 1] F k [i, j + 1] + F k [i, j] that is F k [i, j] F k [i, j] F k [i, j + 1] F k [i, j + 1]
65 Therefore F k [i, j] F k [i, j] F k [i, j + 1] F k [i, j + 1] For all k < s(i, j), F s(i,j) [i, j] = F [i, j] F k [i, j]. So F s(i,j) (i, j + 1) F k (i, j + 1). Hence F s(i,j) [i, j + 1] F k [i, j + 1]. This gives s(i, j) s(i, j + 1).
Maximum sum contiguous subsequence Longest common subsequence Matrix chain multiplication All pair shortest path Kna. Dynamic Programming
Dynamic Programming Arijit Bishnu arijit@isical.ac.in Indian Statistical Institute, India. August 31, 2015 Outline 1 Maximum sum contiguous subsequence 2 Longest common subsequence 3 Matrix chain multiplication
More informationCOSE212: Programming Languages. Lecture 1 Inductive Definitions (1)
COSE212: Programming Languages Lecture 1 Inductive Definitions (1) Hakjoo Oh 2018 Fall Hakjoo Oh COSE212 2018 Fall, Lecture 1 September 5, 2018 1 / 10 Inductive Definitions Inductive definition (induction)
More information{a, b, c} {a, b} {a, c} {b, c} {a}
Section 4.3 Order Relations A binary relation is an partial order if it transitive and antisymmetric. If R is a partial order over the set S, we also say, S is a partially ordered set or S is a poset.
More informationNon-context-Free Languages. CS215, Lecture 5 c
Non-context-Free Languages CS215, Lecture 5 c 2007 1 The Pumping Lemma Theorem. (Pumping Lemma) Let be context-free. There exists a positive integer divided into five pieces, Proof for for each, and..
More informationAutomata Theory CS F-08 Context-Free Grammars
Automata Theory CS411-2015F-08 Context-Free Grammars David Galles Department of Computer Science University of San Francisco 08-0: Context-Free Grammars Set of Terminals (Σ) Set of Non-Terminals Set of
More informationCOSE212: Programming Languages. Lecture 1 Inductive Definitions (1)
COSE212: Programming Languages Lecture 1 Inductive Definitions (1) Hakjoo Oh 2017 Fall Hakjoo Oh COSE212 2017 Fall, Lecture 1 September 4, 2017 1 / 9 Inductive Definitions Inductive definition (induction)
More informationLearning Context Free Grammars with the Syntactic Concept Lattice
Learning Context Free Grammars with the Syntactic Concept Lattice Alexander Clark Department of Computer Science Royal Holloway, University of London alexc@cs.rhul.ac.uk ICGI, September 2010 Outline Introduction
More informationBOUNDS ON ZIMIN WORD AVOIDANCE
BOUNDS ON ZIMIN WORD AVOIDANCE JOSHUA COOPER* AND DANNY RORABAUGH* Abstract. How long can a word be that avoids the unavoidable? Word W encounters word V provided there is a homomorphism φ defined by mapping
More informationOnline Computation of Abelian Runs
Online Computation of Abelian Runs Gabriele Fici 1, Thierry Lecroq 2, Arnaud Lefebvre 2, and Élise Prieur-Gaston2 1 Dipartimento di Matematica e Informatica, Università di Palermo, Italy Gabriele.Fici@unipa.it
More informationGeneral Methods for Algorithm Design
General Methods for Algorithm Design 1. Dynamic Programming Multiplication of matrices Elements of the dynamic programming Optimal triangulation of polygons Longest common subsequence 2. Greedy Methods
More informationShortest paths with negative lengths
Chapter 8 Shortest paths with negative lengths In this chapter we give a linear-space, nearly linear-time algorithm that, given a directed planar graph G with real positive and negative lengths, but no
More informationA Universal Turing Machine
A Universal Turing Machine A limitation of Turing Machines: Turing Machines are hardwired they execute only one program Real Computers are re-programmable Solution: Universal Turing Machine Attributes:
More informationRelations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples.
Relations We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples. Relations use ordered tuples to represent relationships among
More informationMatrix Arithmetic. j=1
An m n matrix is an array A = Matrix Arithmetic a 11 a 12 a 1n a 21 a 22 a 2n a m1 a m2 a mn of real numbers a ij An m n matrix has m rows and n columns a ij is the entry in the i-th row and j-th column
More informationApproximating Shortest Superstring Problem Using de Bruijn Graphs
Approximating Shortest Superstring Problem Using de Bruijn Advanced s Course Presentation Farshad Barahimi Department of Computer Science University of Lethbridge November 19, 2013 This presentation is
More informationLecture 16 Symbolic dynamics.
Lecture 16 Symbolic dynamics. 1 Symbolic dynamics. The full shift on two letters and the Baker s transformation. 2 Shifts of finite type. 3 Directed multigraphs. 4 The zeta function. 5 Topological entropy.
More informationHarvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries
Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries Harry Lewis September 5, 2013 Reading: Sipser, Chapter 0 Sets Sets are defined by their members A = B means that for every x, x A iff
More informationComputer Science & Engineering 423/823 Design and Analysis of Algorithms
Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 03 Dynamic Programming (Chapter 15) Stephen Scott and Vinodchandran N. Variyam sscott@cse.unl.edu 1/44 Introduction Dynamic
More informationAutomata Theory and Formal Grammars: Lecture 1
Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)
More informationDefinition: A binary relation R from a set A to a set B is a subset R A B. Example:
Chapter 9 1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R A B. Example: Let A = {0,1,2} and B = {a,b} {(0, a), (0, b), (1,a), (2, b)} is a relation from A to B.
More information/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programming II Date: 10/12/17
601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programming II Date: 10/12/17 12.1 Introduction Today we re going to do a couple more examples of dynamic programming. While
More informationStreaming and communication complexity of Hamming distance
Streaming and communication complexity of Hamming distance Tatiana Starikovskaya IRIF, Université Paris-Diderot (Joint work with Raphaël Clifford, ICALP 16) Approximate pattern matching Problem Pattern
More informationWith Question/Answer Animations
Chapter 5 With Question/Answer Animations Copyright McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education. Chapter Summary
More informationSingle Source Shortest Paths
CMPS 00 Fall 017 Single Source Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk Paths in graphs Consider a digraph G = (V, E) with an edge-weight
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 14 Ana Bove May 14th 2018 Recap: Context-free Grammars Simplification of grammars: Elimination of ǫ-productions; Elimination of
More informationCHAPTER 1. Relations. 1. Relations and Their Properties. Discussion
CHAPTER 1 Relations 1. Relations and Their Properties 1.1. Definition of a Relation. Definition 1.1.1. A binary relation from a set A to a set B is a subset R A B. If (a, b) R we say a is Related to b
More informationRegularity-preserving letter selections
Regularity-preserving letter selections Armando B. Matos LIACC, Universidade do Porto Rua do Campo Alegre 823, 4150 Porto, Portugal 1 Introduction and definitions Seiferas and McNaughton gave in [SM76]
More information1 Review of Vertex Cover
CS266: Parameterized Algorithms and Complexity Stanford University Lecture 3 Tuesday, April 9 Scribe: Huacheng Yu Spring 2013 1 Review of Vertex Cover In the last lecture, we discussed FPT algorithms for
More informationSection Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence
Section 2.4 1 Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations 2 Introduction Sequences are ordered lists of
More informationCS375 Midterm Exam Solution Set (Fall 2017)
CS375 Midterm Exam Solution Set (Fall 2017) Closed book & closed notes October 17, 2017 Name sample 1. (10 points) (a) Put in the following blank the number of strings of length 5 over A={a, b, c} that
More informationCSEP 590 Data Compression Autumn Arithmetic Coding
CSEP 590 Data Compression Autumn 2007 Arithmetic Coding Reals in Binary Any real number x in the interval [0,1) can be represented in binary as.b 1 b 2... where b i is a bit. x 0 0 1 0 1... binary representation
More informationSemigroup presentations via boundaries in Cayley graphs 1
Semigroup presentations via boundaries in Cayley graphs 1 Robert Gray University of Leeds BMC, Newcastle 2006 1 (Research conducted while I was a research student at the University of St Andrews, under
More informationProperties of Context-Free Languages
Properties of Context-Free Languages Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr
More informationFABER Formal Languages, Automata. Lecture 2. Mälardalen University
CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2010 1 Content Languages, g Alphabets and Strings Strings & String Operations Languages & Language Operations
More informationCS 455/555: Mathematical preliminaries
CS 455/555: Mathematical preliminaries Stefan D. Bruda Winter 2019 SETS AND RELATIONS Sets: Operations: intersection, union, difference, Cartesian product Big, powerset (2 A ) Partition (π 2 A, π, i j
More informationSimplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University
Simplification of CFG and Normal Forms Wen-Guey Tzeng Computer Science Department National Chiao Tung University Normal Forms We want a cfg with either Chomsky or Greibach normal form Chomsky normal form
More informationSimplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University
Simplification of CFG and Normal Forms Wen-Guey Tzeng Computer Science Department National Chiao Tung University Normal Forms We want a cfg with either Chomsky or Greibach normal form Chomsky normal form
More informationComputer Science & Engineering 423/823 Design and Analysis of Algorithms
Computer Science & Engineering 423/823 Design and Analysis of s Lecture 09 Dynamic Programming (Chapter 15) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 41 Spring 2010 Dynamic programming
More informationGreedy Conjecture for Strings of Length 4
Greedy Conjecture for Strings of Length 4 Alexander S. Kulikov 1, Sergey Savinov 2, and Evgeniy Sluzhaev 1,2 1 St. Petersburg Department of Steklov Institute of Mathematics 2 St. Petersburg Academic University
More informationLinear Classifiers (Kernels)
Universität Potsdam Institut für Informatik Lehrstuhl Linear Classifiers (Kernels) Blaine Nelson, Christoph Sawade, Tobias Scheffer Exam Dates & Course Conclusion There are 2 Exam dates: Feb 20 th March
More informationCMPS 6610 Fall 2018 Shortest Paths Carola Wenk
CMPS 6610 Fall 018 Shortest Paths Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk Paths in graphs Consider a digraph G = (V, E) with an edge-weight function w
More informationBasic Principles of Lossless Coding. Universal Lossless coding. Lempel-Ziv Coding. 2. Exploit dependences between successive symbols.
Universal Lossless coding Lempel-Ziv Coding Basic principles of lossless compression Historical review Variable-length-to-block coding Lempel-Ziv coding 1 Basic Principles of Lossless Coding 1. Exploit
More informationQuick Tour of Linear Algebra and Graph Theory
Quick Tour of Linear Algebra and Graph Theory CS224w: Social and Information Network Analysis Fall 2012 Yu Wayne Wu Based on Borja Pelato s version in Fall 2011 Matrices and Vectors Matrix: A rectangular
More informationPacket #1: Logic & Proofs. Applied Discrete Mathematics
Packet #1: Logic & Proofs Applied Discrete Mathematics Table of Contents Course Objectives Page 2 Propositional Calculus Information Pages 3-13 Course Objectives At the conclusion of this course, you should
More informationPartha Sarathi Mandal
MA 252: Data Structures and Algorithms Lecture 32 http://www.iitg.ernet.in/psm/indexing_ma252/y12/index.html Partha Sarathi Mandal Dept. of Mathematics, IIT Guwahati The All-Pairs Shortest Paths Problem
More informationHierarchical Overlap Graph
Hierarchical Overlap Graph B. Cazaux and E. Rivals LIRMM & IBC, Montpellier 8. Feb. 2018 arxiv:1802.04632 2018 B. Cazaux & E. Rivals 1 / 29 Overlap Graph for a set of words Consider the set P := {abaa,
More informationLecture 12 Simplification of Context-Free Grammars and Normal Forms
Lecture 12 Simplification of Context-Free Grammars and Normal Forms COT 4420 Theory of Computation Chapter 6 Normal Forms for CFGs 1. Chomsky Normal Form CNF Productions of form A BC A, B, C V A a a T
More informationTheoretical Computer Science
Theoretical Computer Science Zdeněk Sawa Department of Computer Science, FEI, Technical University of Ostrava 17. listopadu 15, Ostrava-Poruba 708 33 Czech republic September 22, 2017 Z. Sawa (TU Ostrava)
More informationTheory of Computer Science
Theory of Computer Science C1. Formal Languages and Grammars Malte Helmert University of Basel March 14, 2016 Introduction Example: Propositional Formulas from the logic part: Definition (Syntax of Propositional
More informationNew Bounds and Extended Relations Between Prefix Arrays, Border Arrays, Undirected Graphs, and Indeterminate Strings
New Bounds and Extended Relations Between Prefix Arrays, Border Arrays, Undirected Graphs, and Indeterminate Strings F. Blanchet-Sadri Michelle Bodnar Benjamin De Winkle 3 November 6, 4 Abstract We extend
More informationExamples of Groups
Examples of Groups 8-23-2016 In this section, I ll look at some additional examples of groups. Some of these will be discussed in more detail later on. In many of these examples, I ll assume familiar things
More informationIn English, there are at least three different types of entities: letters, words, sentences.
Chapter 2 Languages 2.1 Introduction In English, there are at least three different types of entities: letters, words, sentences. letters are from a finite alphabet { a, b, c,..., z } words are made up
More informationSolutions to Problem Set 3
V22.0453-001 Theory of Computation October 8, 2003 TA: Nelly Fazio Solutions to Problem Set 3 Problem 1 We have seen that a grammar where all productions are of the form: A ab, A c (where A, B non-terminals,
More informationLinear-Time Algorithms for Finding Tucker Submatrices and Lekkerkerker-Boland Subgraphs
Linear-Time Algorithms for Finding Tucker Submatrices and Lekkerkerker-Boland Subgraphs Nathan Lindzey, Ross M. McConnell Colorado State University, Fort Collins CO 80521, USA Abstract. Tucker characterized
More informationTheory of Computation
Theory of Computation Lecture #2 Sarmad Abbasi Virtual University Sarmad Abbasi (Virtual University) Theory of Computation 1 / 1 Lecture 2: Overview Recall some basic definitions from Automata Theory.
More informationDepartment of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007)
Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007) Problem 1: Specify two different predicates P (x) and
More information1. (a) Explain the procedure to convert Context Free Grammar to Push Down Automata.
Code No: R09220504 R09 Set No. 2 II B.Tech II Semester Examinations,December-January, 2011-2012 FORMAL LANGUAGES AND AUTOMATA THEORY Computer Science And Engineering Time: 3 hours Max Marks: 75 Answer
More informationSection Summary. Definition of a Function.
Section 2.3 Section Summary Definition of a Function. Domain, Codomain Image, Preimage Injection, Surjection, Bijection Inverse Function Function Composition Graphing Functions Floor, Ceiling, Factorial
More informationCS6901: review of Theory of Computation and Algorithms
CS6901: review of Theory of Computation and Algorithms Any mechanically (automatically) discretely computation of problem solving contains at least three components: - problem description - computational
More informationSection 1 (closed-book) Total points 30
CS 454 Theory of Computation Fall 2011 Section 1 (closed-book) Total points 30 1. Which of the following are true? (a) a PDA can always be converted to an equivalent PDA that at each step pops or pushes
More informationSpecial Factors and Suffix and Factor Automata
Special Factors and Suffix and Factor Automata LIAFA, Paris 5 November 2010 Finite Words Let Σ be a finite alphabet, e.g. Σ = {a, n, b, c}. A word over Σ is finite concatenation of symbols of Σ, that is,
More information1 Alphabets and Languages
1 Alphabets and Languages Look at handout 1 (inference rules for sets) and use the rules on some examples like {a} {{a}} {a} {a, b}, {a} {{a}}, {a} {{a}}, {a} {a, b}, a {{a}}, a {a, b}, a {{a}}, a {a,
More informationComputing Longest Common Substrings Using Suffix Arrays
Computing Longest Common Substrings Using Suffix Arrays Maxim A. Babenko, Tatiana A. Starikovskaya Moscow State University Computer Science in Russia, 2008 Maxim A. Babenko, Tatiana A. Starikovskaya (MSU)Computing
More informationOn the Number of Distinct Squares
Frantisek (Franya) Franek Advanced Optimization Laboratory Department of Computing and Software McMaster University, Hamilton, Ontario, Canada Invited talk - Prague Stringology Conference 2014 Outline
More informationNote that M i,j depends on two entries in row (i 1). If we proceed in a row major order, these two entries will be available when we are ready to comp
CSE 3500 Algorithms and Complexity Fall 2016 Lecture 18: October 27, 2016 Dynamic Programming Steps involved in a typical dynamic programming algorithm are: 1. Identify a function such that the solution
More informationMultiplying Products of Prime Powers
Problem 1: Multiplying Products of Prime Powers Each positive integer can be expressed (in a unique way, according to the Fundamental Theorem of Arithmetic) as a product of powers of the prime numbers.
More informationcse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 5 CHAPTER 2 FINITE AUTOMATA 1. Deterministic Finite Automata DFA 2. Nondeterministic Finite Automata NDFA 3. Finite Automata
More informationUNIVERSITY OF MICHIGAN UNDERGRADUATE MATH COMPETITION 27 MARCH 28, 2010
UNIVERSITY OF MICHIGAN UNDERGRADUATE MATH COMPETITION 27 MARCH 28, 200 Instructions. Write on the front of your blue book your student ID number. Do not write your name anywhere on your blue book. Each
More informationSets are one of the basic building blocks for the types of objects considered in discrete mathematics.
Section 2.1 Introduction Sets are one of the basic building blocks for the types of objects considered in discrete mathematics. Important for counting. Programming languages have set operations. Set theory
More informationToday s topics. Introduction to Set Theory ( 1.6) Naïve set theory. Basic notations for sets
Today s topics Introduction to Set Theory ( 1.6) Sets Definitions Operations Proving Set Identities Reading: Sections 1.6-1.7 Upcoming Functions A set is a new type of structure, representing an unordered
More informationIntroduction to Kleene Algebras
Introduction to Kleene Algebras Riccardo Pucella Basic Notions Seminar December 1, 2005 Introduction to Kleene Algebras p.1 Idempotent Semirings An idempotent semiring is a structure S = (S, +,, 1, 0)
More informationTheory of Computation
Theory of Computation (Feodor F. Dragan) Department of Computer Science Kent State University Spring, 2018 Theory of Computation, Feodor F. Dragan, Kent State University 1 Before we go into details, what
More informationLanguage-Processing Problems. Roland Backhouse DIMACS, 8th July, 2003
1 Language-Processing Problems Roland Backhouse DIMACS, 8th July, 2003 Introduction 2 Factors and the factor matrix were introduced by Conway (1971). He used them very effectively in, for example, constructing
More informationElementary maths for GMT
Elementary maths for GMT Linear Algebra Part 2: Matrices, Elimination and Determinant m n matrices The system of m linear equations in n variables x 1, x 2,, x n a 11 x 1 + a 12 x 2 + + a 1n x n = b 1
More informationAuthor: Vivek Kulkarni ( )
Author: Vivek Kulkarni ( vivek_kulkarni@yahoo.com ) Chapter-2: Finite State Machines Solutions for Review Questions @ Oxford University Press 2013. All rights reserved. 1 Q.1 Construct Mealy and Moore
More information18.10 Addendum: Arbitrary number of pigeons
18 Resolution 18. Addendum: Arbitrary number of pigeons Razborov s idea is to use a more subtle concept of width of clauses, tailor made for this particular CNF formula. Theorem 18.22 For every m n + 1,
More informationCS3719 Theory of Computation and Algorithms
CS3719 Theory of Computation and Algorithms Any mechanically (automatically) discretely computation of problem solving contains at least three components: - problem description - computational tool - analysis
More informationCS60007 Algorithm Design and Analysis 2018 Assignment 1
CS60007 Algorithm Design and Analysis 2018 Assignment 1 Palash Dey and Swagato Sanyal Indian Institute of Technology, Kharagpur Please submit the solutions of the problems 6, 11, 12 and 13 (written in
More informationProving languages to be nonregular
Proving languages to be nonregular We already know that there exist languages A Σ that are nonregular, for any choice of an alphabet Σ. This is because there are uncountably many languages in total and
More informationChapter Summary. Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms
1 Chapter Summary Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms 2 Section 5.1 3 Section Summary Mathematical Induction Examples of
More informationA necessary and sufficient condition for the existence of a spanning tree with specified vertices having large degrees
A necessary and sufficient condition for the existence of a spanning tree with specified vertices having large degrees Yoshimi Egawa Department of Mathematical Information Science, Tokyo University of
More informationDFA to Regular Expressions
DFA to Regular Expressions Proposition: If L is regular then there is a regular expression r such that L = L(r). Proof Idea: Let M = (Q,Σ, δ, q 1, F) be a DFA recognizing L, with Q = {q 1,q 2,...q n },
More informationIndian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai , India. Instructor N.Sadagopan Scribe: P.
Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600 127, India An Autonomous Institute under MHRD, Govt of India An Institute of National Importance www.iiitdm.ac.in
More informationData Structures in Java
Data Structures in Java Lecture 20: Algorithm Design Techniques 12/2/2015 Daniel Bauer 1 Algorithms and Problem Solving Purpose of algorithms: find solutions to problems. Data Structures provide ways of
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Theory of Regular Expressions DFAs and NFAs Reminders Project 1 due Sep. 24 Homework 1 posted Exam 1 on Sep. 25 Exam topics list posted Practice homework
More informationComplexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler
Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard
More informationOutline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.
Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität
More informationCSCI 340: Computational Models. Regular Expressions. Department of Computer Science
CSCI 340: Computational Models Regular Expressions Chapter 4 Department of Computer Science Yet Another New Method for Defining Languages Given the Language: L 1 = {x n for n = 1 2 3...} We could easily
More informationProbabilistic Aspects of Computer Science: Probabilistic Automata
Probabilistic Aspects of Computer Science: Probabilistic Automata Serge Haddad LSV, ENS Paris-Saclay & CNRS & Inria M Jacques Herbrand Presentation 2 Properties of Stochastic Languages 3 Decidability Results
More informationCS6902 Theory of Computation and Algorithms
CS6902 Theory of Computation and Algorithms Any mechanically (automatically) discretely computation of problem solving contains at least three components: - problem description - computational tool - procedure/analysis
More informationUNIT-I. Strings, Alphabets, Language and Operations
UNIT-I Strings, Alphabets, Language and Operations Strings of characters are fundamental building blocks in computer science. Alphabet is defined as a non empty finite set or nonempty set of symbols. The
More informationHomework 4 Solutions. 2. Find context-free grammars for the language L = {a n b m c k : k n + m}. (with n 0,
Introduction to Formal Language, Fall 2016 Due: 21-Apr-2016 (Thursday) Instructor: Prof. Wen-Guey Tzeng Homework 4 Solutions Scribe: Yi-Ruei Chen 1. Find context-free grammars for the language L = {a n
More informationMathematical Preliminaries. Sipser pages 1-28
Mathematical Preliminaries Sipser pages 1-28 Mathematical Preliminaries This course is about the fundamental capabilities and limitations of computers. It has 3 parts 1. Automata Models of computation
More informationChapter 3 Source Coding. 3.1 An Introduction to Source Coding 3.2 Optimal Source Codes 3.3 Shannon-Fano Code 3.4 Huffman Code
Chapter 3 Source Coding 3. An Introduction to Source Coding 3.2 Optimal Source Codes 3.3 Shannon-Fano Code 3.4 Huffman Code 3. An Introduction to Source Coding Entropy (in bits per symbol) implies in average
More information19. Logic constraints, integer variables
CS/ECE/ISyE 524 Introduction to Optimization Spring 2016 17 19. Logic constraints, integer variables If-then constraints Generalized assignment problems Logic constraints Modeling a restricted set of values
More informationIntroduction. I Dynamic programming is a technique for solving optimization problems. I Key element: Decompose a problem into subproblems, solve them
ntroduction Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 03 Dynamic Programming (Chapter 15) Stephen Scott and Vinodchandran N. Variyam Dynamic programming is a technique
More informationq-counting hypercubes in Lucas cubes
Turkish Journal of Mathematics http:// journals. tubitak. gov. tr/ math/ Research Article Turk J Math (2018) 42: 190 203 c TÜBİTAK doi:10.3906/mat-1605-2 q-counting hypercubes in Lucas cubes Elif SAYGI
More informationDynamic Programming: Shortest Paths and DFA to Reg Exps
CS 374: Algorithms & Models of Computation, Spring 207 Dynamic Programming: Shortest Paths and DFA to Reg Exps Lecture 8 March 28, 207 Chandra Chekuri (UIUC) CS374 Spring 207 / 56 Part I Shortest Paths
More informationIntroduction to Automata
Introduction to Automata Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr 1 /
More informationChapter 1. Introduction
Chapter Introduction.0 BASICS.0. Sets A set is a collection of objects. For example, the collection of four letters a, b, c and d is a set, which is written as L ={a, b, c, d } The objects comprising a
More information