CSCI 2670 Introduction to Theory of Computing November 15, 2005.

Slides:



Advertisements
Similar presentations
Measuring Time Complexity
Advertisements

Turing Machines Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only.
Variants of Turing machines
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Foundations of (Theoretical) Computer Science Chapter 3 Lecture Notes (Section 3.2: Variants of Turing Machines) David Martin With.
CS605 – The Mathematics and Theory of Computer Science Turing Machines.
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)
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
Complexity ©D.Moshkovitz 1 Turing Machines. Complexity ©D.Moshkovitz 2 Motivation Our main goal in this course is to analyze problems and categorize them.
CS5371 Theory of Computation Lecture 11: Computability Theory II (TM Variants, Church-Turing Thesis)
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 8+9 Time complexity 1 Jan Maluszynski, IDA, 2007
CS 310 – Fall 2006 Pacific University CS310 P vs NP the steel cage death match Section 7.2 November 29, 2006.
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
CS 310 – Fall 2006 Pacific University CS310 Complexity Section 7.1 November 27, 2006.
1 Turing Machines. 2 A Turing Machine Tape Read-Write head Control Unit.
CS 461 – Nov. 21 Sections 7.1 – 7.2 Measuring complexity Dividing decidable languages into complexity classes. Algorithm complexity depends on what kind.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 2670 Introduction to Theory of Computing November 10, 2005.
חישוביות וסיבוכיות 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.
Computer Language Theory
Measuring complexity Section 7.1 Giorgi Japaridze Theory of Computability.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
Umans Complexity Theory Lectures Lecture 1b: Turing Machines & Halting Problem.
Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3
 2005 SDU Lecture14 Mapping Reducibility, Complexity.
CSE 105 theory of computation
Turing’s Thesis.
Turing’s Thesis Costas Busch - LSU.
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
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
Busch Complexity Lectures: Reductions
CSCI 2670 Introduction to Theory of Computing
Reductions Costas Busch - LSU.
Polynomial time The Chinese University of Hong Kong Fall 2010
(Universal Turing Machine)
CSE 105 theory of computation
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
CSCI 2670 Introduction to Theory of Computing
Turing Machines Acceptors; Enumerators
Intro to Theory of Computation
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CS21 Decidability and Tractability
CS21 Decidability and Tractability
CS154, Lecture 12: Time Complexity
CSC 4170 Theory of Computation Time complexity Section 7.1.
Turing Machines Complexity ©D.Moshkovitz.
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
CSE 105 theory of computation
Theory of Computability
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
Variants of Turing machines
CSE 105 theory of computation
CSC 4170 Theory of Computation Time complexity Section 7.1.
Theory of Computability
Intro to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

CSCI 2670 Introduction to Theory of Computing November 15, 2005

Agenda Today –Comparing complexity of different computing models This week –Finish 7.1 and do 7.2

November 15, 2005 Announcement Office hours changed tomorrow –11:30 to 1:00 instead of 11:00 – 12:30

November 15, 2005 Analyzing algorithms We can examine an algorithm to determine how long it will take to halt on an input of length n The amount of time to complete is called the algorithms complexity class Definition: Let t:N → N be a function. The time complexity class, TIME(t(n)), is defined as follows. TIME(t(n))={L|L is a language decided by an O(t(n)) time TM}

November 15, 2005 Another example Finding minimum element in a set Amount of time depends on the structure of the input If set is a sorted array? –O(1) If set is an unsorted array? –O(n) If set is a balanced sorted tree? –O(log n)

November 15, 2005 Importance of model The complexity of our algorithms depends on assumptions about our data & other model assumptions The complexity of an algorithm can vary depending on the machine we use Recall we assume reasonable encoding of all numbers –Any integer of value v should take O(log v) space

November 15, 2005 Machine-dependent complexity Example, let L={w | w is a palindrome} How long will it take us to decide L on a standard TM? –Go back and forth crossing off matching symbols at beginning and end –O(n 2 ) How long will it take us to decide L on a 2- tape TM? –Copy string –Compare symbols reading forward on tape 1 and backward on tape 2 –O(n)

November 15, 2005 Complexity relationships Theorem: Let t(n) be a function, where t(n)  n. Then every t(n) time multitape TM has an equivalent O(t 2 (n)) time single-tape TM Proof idea: Consider structure of equivalent single-tape TM. Analyzing behavior shows each step on multi- tape machine takes O(t(n)) on single tape machine

November 15, 2005 Equivalent machines M 0 1 ~ ~ ~ ~ ~ ~ a a a ~ ~ ~ ~ ~ a b ~ ~ ~ ~ ~ ~ # 0 1 # a a a # a b # ~ ~ S

November 15, 2005 Simulating k-tape behavior Single tape start string is #w#~#...#~# Each move proceeds as follows: –Start at leftmost slot –Scan right to (k+1) st # to find symbol at each virtual tape head –Make second pass making updates indicated by k-tape transition function –When a virtual head moves onto a #, shift string to right

November 15, 2005 Proof of theorem Analyzing simulation of k-tape machine Each step on single-tape machine has two phases –Scan tape –Perform operations How long does first phase take? –Length of string on tape –Each portion has O(t(n)) length (this occurs if tape heads only move right)

November 15, 2005 Proof of theorem (cont.) How long does second phase take? –Perform k steps Each step may require a right shift –Each step takes O(t(n)) time –Total of k steps is O(t(n)) because k is a constant What’s the total time? –O(t(n)) steps each take O(t(n)) time –Total time is O(t 2 (n))

November 15, 2005 Determinism vs. non-determinism Definition: Let P be a non- deterministic Turing machine. The running time of P is the function f:N → N, where f(n) is the maximum number of steps that P uses on any branch of its computation in any input of length n.

November 15, 2005 Non-deterministic tree f(n) accept/ reject Deterministic … … reject accept Non-deterministic

November 15, 2005 Complexity relationship Theorem: Let t(n) be a function where t(n)  n. Then every t(n) time non- deterministic single-tape Turing machine has an equivalent 2 O(t(n)) time deterministic single-tape Turing machine.

November 15, 2005 Complexity relationship proof Proof: Given a non-deterministic TM, P, running in t(n) time, construct a 3-tape deterministic TM that simulates P. The height of the tree is at most t(n). Assume the maximum number of branches in the tree is b. Therefore, the number of leaves in the tree is O(b t(n) ).

November 15, 2005 How many nodes in the tree? Claim: The total number of nodes is less than twice the number of leaves – i.e. O(b t(n) ). (Σ 0≤k≤n b k )  b n = (1 – b n+1 )/(1-b)  b n < – b n+1 /(1-b)  b n = - b / (1-b) ≤ 2

November 15, 2005 Complexity relationship proof (cont.) Deterministic TM does a breadth- first search of the non-deterministic TM’s tree. Total time to search tree is O(t(n)) to travel from the root to a leaf × O(b t(n) ), the number of leaves. O(t(n)b t(n) ) = O(2 log_2 t(n) 2 (log_2 b)t(n) ) = O(2 O(t(n)) )

November 15, 2005 Complexity relationship proof (cont.) Are we done? No! We constructed a 3-tape TM with running time O(2 O(t(n)) ) Single-tape TM will take O((2 O(t(n)) ) 2 )=O(2 2O(t(n)) )=O(2 O(t(n)) ) Are we done? Yes!