Lecture15x - 15-453 FORMAL LANGUAGES, AUTOMATA AND...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 Read sections 7.1 – 7.3 of the book for next time
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
TIME COMPLEXITY OF ALGORITHMS (Chapter 7 in the textbook)
Background image of page 2
COMPLEXITY THEORY Studies what can and can’t be computed under limited resources such as time, space, etc. Today: Time complexity
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MEASURING TIME COMPLEXITY We measure time complexity by counting the elementary steps required for a machine to halt Consider the language A = { 0 k 1 k | k 0 } 1. Scan across the tape and reject if the string is not of the form 0 m 1 n 2. Repeat the following if both 0s and 1s remain on the tape: Scan across the tape, crossing off a single 0 and a single 1 3. If 0s remain after all 1s have been crossed off, or vice-versa, reject . Otherwise accept . 2k 2k 2 2k
Background image of page 4
The number of steps that an algorithm uses on a particular input may depend on several parameters. For instance, if the input is a graph, then the number of steps may depend on the number of nodes, the number of edges, et cetera . For simplicity, we compute the running time purely as a function of the length of the input string and don’t consider any other parameters.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Let M be a TM that halts on all inputs. Assume we compute the running time purely as a function of the length of the input string. Definition: The running time or time-complexity function of M is the function f : N N such that f(n) is the maximum number of steps that M uses on any input of length n.
Background image of page 6
ASYMPTOTIC ANALYSIS 5n 3 + 2n 2 + 22n + 6 = O(n 3 ) Big-O notation has been discussed in previous classes. We will briefly review it.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Let f and g be two functions f, g : N R + . We say that f(n) = O(g(n)) if positive integers c and n 0 exist so that for every integer n n 0 f(n) c g(n) When f(n) = O(g(n)), we say that g(n) is an asymptotic upper bound for f(n) BIG-O 5n 3 + 2n 2 + 22n + 6 = O(n 3 ) If c = 6 and n 0 = 10, then 5n 3 + 2n 2 + 22n + 6 cn 3
Background image of page 8
3 n log 2 n + 5 n log 2 log 2 n 2 n 4.1 + 200283 n 4 + 2 n log 10 n 78 = O(n 4.1 ) = O(n log 2 n) = O(n log 10 n) log 10 n = log 2 n / log 2 10 O(n log 2 n) = O(n log 10 n) = O(n log n)
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
TIME(t(n)) is the set of languages decidable in O(t(n)) time by a Turing Machine.
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 47

Lecture15x - 15-453 FORMAL LANGUAGES, AUTOMATA AND...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online