Measuring Time Complexity Sipser 7.1 (pages 247-256)

Slides:



Advertisements
Similar presentations
Algorithms Sipser 3.3 (pages ). CS 311 Fall Computability Hilbert's Tenth Problem: Find a process according to which it can be determined.
Advertisements

Measuring Time Complexity
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
The diagonalization method The halting problem is undecidable Decidability.
Computability and Complexity 22-1 Computability and Complexity Andrei Bulatov Hierarchy Theorem.
P and NP Sipser (pages ). CS 311 Fall Polynomial time P = ∪ k TIME(n k ) … P = ∪ k TIME(n k ) … TIME(n 3 ) TIME(n 2 ) TIME(n)
Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Mount Holyoke College 2 Building languages If L is a language, then its complement is L’ = {w |
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Mount Holyoke College 2 The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
Algorithms Sipser 3.3 (pages ). CS 311 Mount Holyoke College 2 Computability Hilbert's Tenth Problem: Find “a process according to which it can.
More Turing Machines Sipser 3.2 (pages ). CS 311 Fall Multitape Turing Machines Formally, we need only change the transition function to.
Reducibility Sipser 5.1 (pages ). CS 311 Fall Reducibility.
Turing machines Sipser 2.3 and 3.1 (pages )
Reducibility Sipser 5.1 (pages ).
Regular expressions Sipser 1.3 (pages 63-76). CS 311 Mount Holyoke College 2 Looks familiar…
The Halting Problem Sipser 4.2 (pages ). CS 311 Mount Holyoke College 2 Taking stock All languages Turing-recognizable Turing-decidable Context-free.
The Halting Problem Sipser 4.2 (pages ).
Mapping Reducibility Sipser 5.3 (pages ).
More Turing Machines Sipser 3.2 (pages ).
Mapping Reducibility Sipser 5.3 (pages ). CS 311 Fall Computable functions Definition 5.17: A function f:Σ*→Σ* is a computable function.
Decidable languages Sipser 4.1 (pages ). CS 311 Mount Holyoke College 2 Hierarchy of languages All languages Turing-recognizable Turing-decidable.
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
CS 310 – Fall 2006 Pacific University CS310 Decidability Section 4.1/4.2 November 10, 2006.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 8+9 Time complexity 1 Jan Maluszynski, IDA, 2007
Fall 2006Costas Busch - RPI1 Undecidable Problems (unsolvable problems)
Prof. Busch - LSU1 Undecidable Problems (unsolvable problems)
CS 310 – Fall 2006 Pacific University CS310 Complexity Section 7.1 November 27, 2006.
CS 461 – Nov. 21 Sections 7.1 – 7.2 Measuring complexity Dividing decidable languages into complexity classes. Algorithm complexity depends on what kind.
חישוביות וסיבוכיות Computability and Complexity Lecture 7 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AAAA.
Lower Bounds on the Time-complexity of Non-regular Languages on One-tape Turing Machine Miaohua Xu For Theory of Computation II Professor: Geoffrey S.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Computer Language Theory
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Part 1 – Pages COMPUTABILITY THEORY.
Measuring complexity Section 7.1 Giorgi Japaridze Theory of Computability.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
CSCI 2670 Introduction to Theory of Computing October 12, 2005.
D E C I D A B I L I T Y 1. 2 Objectives To investigate the power of algorithms to solve problems. To explore the limits of algorithmic solvability. To.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Hierarchy theorems Section 9.1 Giorgi Japaridze Theory of Computability.
Alternation Section 10.3 Giorgi Japaridze Theory of Computability.
Fall 2013 CMU CS Computational Complexity Lecture 2 Diagonalization, 9/12/2013.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
Turing Machines Sections 17.6 – The Universal Turing Machine Problem: All our machines so far are hardwired. ENIAC
Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3
Decidability.
CSCI 2670 Introduction to Theory of Computing November 15, 2005.
 2005 SDU Lecture14 Mapping Reducibility, Complexity.
CSE 105 theory of computation
CSCI 2670 Introduction to Theory of Computing
Time complexity Here we will consider elements of computational complexity theory – an investigation of the time (or other resources) required for solving.
Polynomial time The Chinese University of Hong Kong Fall 2010
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
Decidability and Enumerability
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
Summary.
Intro to Theory of Computation
CS21 Decidability and Tractability
Theory of Computability
CS154, Lecture 12: Time Complexity
CSC 4170 Theory of Computation Time complexity Section 7.1.
CSE 105 theory of computation
Theory of Computability
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
CSC 4170 Theory of Computation Time complexity Section 7.1.
Intro to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

Measuring Time Complexity Sipser 7.1 (pages )

CS 311 Mount Holyoke College 2 Solvable… in theory Turing-decidable Turing- recognizable co-Turing- recognizable Mastermind Sorting

CS 311 Mount Holyoke College 3 Measuring Difficulty How hard is it to decide {0 k 1 k | k ≥ 0} ? Finite control

CS 311 Mount Holyoke College 4 An algorithm M 1 ="On input string w : 1.Scan across the tape and reject if a 0 is found to the right of a 1. 2.Repeat the following if both 0 s and 1 s remain. 3. Scan across tape, crossing off a single 0 and a single 1. 4.If either 0 or 1 remains, reject. Else, accept."

CS 311 Mount Holyoke College 5 Number of steps depends on the size of the input Finite control

CS 311 Mount Holyoke College 6 Which inputs do we consider? For a particular input length: –Worst-case analysis: longest running time of all inputs –Average-case analysis: average of running times of all inputs

CS 311 Mount Holyoke College 7 Time complexity Definition 7.1 The time complexity of TM M is the function f:N → N, where f(n) is the maximum number of steps that M uses on any input of length n.

CS 311 Mount Holyoke College 8 Asymptotic analysis n2n2 n 1

CS 311 Mount Holyoke College 9 Big-O and small-o Let f, g:N → R +. Definition 7.2 We say that f(n) = O(g(n)) if positive integers c and n 0 exist so that for every n≥n 0 f(n) ≤ c g(n) Definition 7.5 We say that f(n) = o(g(n)) if

CS 311 Mount Holyoke College 10 So now… M 1 ="On input string w : 1.Scan across the tape and reject if a 0 is found to the right of a 1. 2.Repeat the following if both 0 s and 1 s remain. 3. Scan across tape, crossing off a single 0 and a single 1. 4.If either 0 or 1 remains, reject. Else, accept." Finite control

CS 311 Mount Holyoke College 11 Time Complexity Classes Definition 7.7 Let t:N → N be a function. Define the time complexity class, TIME(t(n)), to be the collection of all languages that are decidable by an O(t(n)) time TM. Example: The language {0 k 1 k | k ≥ 0} ∈ TIME(n 2 ).* *And TIME(n 3 ) and TIME(n 4 ) and…

CS 311 Mount Holyoke College 12 Losing time complexity M 2 ="On input string w : 1.Scan across the tape and reject if a 0 is found to the right of a 1. 2.Repeat the following if both 0 s and 1 s remain. 3. Scan across tape, checking whether the total number 0 s and 1 s on remaining on the tape is even or odd. If odd, reject. 4. Scan again across tape, crossing off every other 0, and every other 1. 5.If no 0 s or 1 s remain, accept. Else, reject."

CS 311 Mount Holyoke College 13 Can we do better? Theorem: Let f:N → N be any function where f(n) = o(n log n). TIME(f(n)) contains only regular languages.

CS 311 Mount Holyoke College 14 Well… what if we had two tapes? Finite control

CS 311 Mount Holyoke College 15 A 2-tape algorithm M 3 = “On input w : 1.Scan across the tape and reject if a 0 is found to the right of a 1. 2.Scan across the 0 s on tape 1 until the first 1. At the same time, copy the 0 s onto tape 2. 3.Scan across the 1 s on tape 1 until the end of the input. For each 1 read on tape 1, cross off a 0 on tape 2. If all 0 s are crossed off before all the 1 s are read, reject. 4.If all the 0 s have now been cross off, accept. If any 0 s remain, reject.

CS 311 Mount Holyoke College 16 How to compare? Theorem 7.8 Let t(n) be a function, where t(n) ≥ n. Then every t(n) time multitape Turing machine has an equivalent O(t 2 (n)) time single-tape Turing machine. Proof: Compare the time complexity of the given multitape machine with the single tape equivalent given in Theorem 3.13.