Measuring Time Complexity

Slides:



Advertisements
Similar presentations
By John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman
Advertisements

Formal Models of Computation Part III Computability & Complexity
Regular operations Sipser 1.1 (pages 44 – 47). CS 311 Fall Building languages If L is a language, then its complement is L’ = {w | w ∉ L} Let A.
Algorithms Sipser 3.3 (pages ). CS 311 Fall Computability Hilbert's Tenth Problem: Find a process according to which it can be determined.
Introduction to Computability Theory
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
NFAs and DFAs Sipser 1.2 (pages 47-63).
Variants of Turing machines
1 Nondeterministic Space is Closed Under Complement Presented by Jing Zhang and Yingbo Wang Theory of Computation II Professor: Geoffrey Smith.
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Measuring Time Complexity Sipser 7.1 (pages )
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)
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.
Reducibility Sipser 5.1 (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.
Fall 2004COMP 3351 Reducibility. Fall 2004COMP 3352 Problem is reduced to problem If we can solve problem then we can solve problem.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 8+9 Time complexity 1 Jan Maluszynski, IDA, 2007
Regular expressions Sipser 1.3 (pages 63-76). CS 311 Fall Looks familiar…
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.
1 Reducibility. 2 Problem is reduced to problem If we can solve problem then we can solve problem.
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.
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.
CSCI 2670 Introduction to Theory of Computing October 13, 2005.
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.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong Polynomial.
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.
CSCI 2670 Introduction to Theory of Computing
Undecidable Problems Costas Busch - LSU.
Polynomial time The Chinese University of Hong Kong Fall 2010
CSE 105 theory of computation
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
Decidability and Enumerability
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
Undecidable Problems (unsolvable problems)
Intro to Theory of Computation
CSCI 2670 Introduction to Theory of Computing
Decidable Languages Costas Busch - LSU.
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
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 247-256)

Solvable… in theory Turing- recognizable co-Turing- recognizable Sorting Mastermind Turing- recognizable co-Turing- recognizable Turing-decidable

Measuring Difficulty How hard is it to decide {0k1k | k ≥ 0}? 1 1 1 ⨆ 1 1 1 ⨆ ⨆ ⨆ Finite control

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

Number of steps depends on the size of the input 1 1 1 ⨆ ⨆ ⨆ Finite control

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

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.

Asymptotic analysis n2 n 1

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 n0 exist so that for every n≥n0 f(n) ≤ c g(n) Definition 7.5 We say that f(n) = o(g(n)) if

So now… M1 ="On input string w: Scan across the tape and reject if a 0 is found to the right of a 1. Repeat the following if both 0s and 1s remain. Scan across tape, crossing off a single 0 and a single 1. If either 0 or 1 remains, reject. Else, accept." 1 ⨆ Finite control

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 {0k1k | k ≥ 0} ∈ TIME(n2).* *And TIME(n3) and TIME(n4) and…

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

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.

Well… what if we had two tapes? 1 1 1 ⨆ ⨆ ⨆ Finite control 1 1 1 ⨆ ⨆ ⨆

A 2-tape algorithm M3 = “On input w: Scan across the tape and reject if a 0 is found to the right of a 1. Scan across the 0s on tape 1 until the first 1. At the same time, copy the 0s onto tape 2. Scan across the 1s 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 0s are crossed off before all the 1s are read, reject. If all the 0s have now been cross off, accept. If any 0s remain, reject.

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(t2(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.