The Definition of Algorithm

Slides:



Advertisements
Similar presentations
Part VI NP-Hardness. Lecture 23 Whats NP? Hard Problems.
Advertisements

Chapter 8 Topics in Graph Theory
Graph-02.
Section 14.1 Intro to Graph Theory. Beginnings of Graph Theory Euler’s Konigsberg Bridge Problem (18 th c.)  Can one walk through town and cross all.
Lecture 21 Nondeterministic Polynomial time, and the class NP FIT2014 Theory of Computation Monash University Faculty of Information Technology Slides.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Lecture 4 Topics –Problem solving Subroutine Theme –REC language class The class of solvable problems Closure properties.
Fall 2003Costas Busch - RPI1 Decidability. Fall 2003Costas Busch - RPI2 Recall: A language is decidable (recursive), if there is a Turing machine (decider)
Prof. Busch - LSU1 Undecidable Problems (unsolvable problems)
Euler Circuit Chapter 5. Fleury’s Algorithm Euler’s theorems are very useful to find if a graph has an Euler circuit or an Euler path when the graph is.
CMPS 3223 Theory of Computation Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided.
Complexity 2-1 Problems and Languages Complexity Andrei Bulatov.
Complexity 25-1 Complexity Andrei Bulatov Counting Problems.
MA/CSSE 474 Theory of Computation Decision Problems DFSMs.
The Class NP Lecture 39 Section 7.3 Mon, Nov 26, 2007.
Computability Heap exercise. The class P. The class NP. Verifiers. Homework: Review RELPRIME proof. Find examples of problems in NP.
MAT 2720 Discrete Mathematics Section 8.2 Paths and Cycles
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 15 Graph Theory.
Chapter 6: Graphs 6.1 Euler Circuits
1) Find and label the degree of each vertex in the graph.
The Big Picture Chapter 3.
CS 461 – Oct. 28 TM applications –Recognize a language √ –Arithmetic √ –Enumerate a set –Encode a data structure or problem to solve Two kinds of TMs –Decider:
The Big Picture Chapter 3. A decision problem is simply a problem for which the answer is yes or no (True or False). A decision procedure answers a decision.
Costas Busch - RPI1 Decidability. Costas Busch - RPI2 Consider problems with answer YES or NO Examples: Does Machine have three states ? Is string a binary.
1 Recursively Enumerable and Recursive Languages.
Recursively Enumerable and Recursive Languages. Definition: A language is recursively enumerable if some Turing machine accepts it.
Decidability.
Trees.
Chapters 11 and 12 Decision Problems and Undecidability.
Limitation of Computation Power – P, NP, and NP-complete
EECS 203 Lecture 19 Graphs.
Çizge Algoritmaları.
Lecture 2-2 NP Class.
Part VI NP-Hardness.
Linear Bounded Automata LBAs
Undecidable Problems Costas Busch - LSU.
MA/CSSE 474 Decision Problems Languages, Machines, Computation
Euler Paths and Circuits
Konigsberg’s Seven Bridges
Discrete Structures – CNS2300
Lecture 22 Complexity and Reductions
Computing with Turing Machines
Computing with Turing Machines
Decidability and Enumerability
Busch Complexity Lectures: Undecidable Problems (unsolvable problems)
Discrete Math: Hamilton Circuits
Can you draw this picture without lifting up your pen/pencil?
Euler Paths & Euler Circuits
Introduction to Graph Theory Euler and Hamilton Paths and Circuits
Graph Theory.
Lecture 15: Graph Theory II
Decidable Languages Costas Busch - LSU.
Functional Properties and Problem Reduction
Time Complexity We use a multitape Turing machine
Chapter 34: NP-Completeness
A path that uses every vertex of the graph exactly once.
NP-Complete Problems.
Formal Languages, Automata and Models of Computation
Time Complexity Classes
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Euler and Hamilton Paths
Applied Combinatorics, 4th Ed. Alan Tucker
Warm Up – Tuesday Find the critical times for each vertex.
Warm Up – 3/19 - Wednesday Give the vertex set. Give the edge set.
Hamilton Paths and Circuits
Instructor: Aaron Roth
A Survey of Mathematics with Applications
Lecture 23 NP-Hard Problems
Presentation transcript:

The Definition of Algorithm Lecture 29 Section 3.3 Mon, Oct 29, 2007

The Definition of Algorithm An algorithm is a Turing machine that always halts. In other words, an algorithm is a Turing machine that decides a language.

Algorithms and Problems We think of algorithms as procedures used to solve problems. How does a Turing machine that decides a language solve a problem?

Algorithms and Problems The key is to represent a problem as a string in a language.

The Primality Problem Suppose the problem is to determine whether a given integer is prime. Then the “problem” is encoded as the integer n, written on the input tape. The algorithm would be to test every integer from 2 to n – 1 to see whether it is a divisor of n.

The Primality Problem The language would be the set of all binary representations of primes. LPrime = {10, 11, 101, 111, …}.

The Primality Problem Then, given the binary representation of an integer, we answer the question of whether it is in the language LPrime.

Decision Problems Most of the problems that we will consider will be decision problems. A decision problem is a problem whose solution is a yes or no answer.

Euler Circuits Suppose the problem is to determine whether a given graph has an Euler circuit. An Euler circuit is a closed path that traverses every edge exactly once.

Euler Circuits Theorem: A graph has an Euler circuit if and only if it is connected and every vertex has even degree.

Euler Circuits We may represent the graph as An integer n representing the number of vertices. A list of pairs (i, j) representing edges between vertices i and j.

Euler Circuits A Turing machine could solve the problem by scanning the tape to determine the index of each vertex. If any vertex has odd degree, then the graph does not have an Euler circuit.

Euler Circuits How would we determine whether the graph was connected? If the graph is connected (and every vertex has even degree), then the answer is yes, it has an Euler Circuit.

Instances of Problems When we solve a specific problem, we are solving an instance P of a general problem. We will use the notation P to stand for the binary representation of the instance P.

Instances of Problems In the case of the Primality Problem, if n = 29, then n = 11101.

Example In the Euler circuit problem, let the graph G be 1 4 3 5 6 2

Example The representation of G could be 6,{(1,2),(1,3),(2,3),(2,4),(2,5),(3,4),(3,5),(4,5),(4,6),(5,6)} This entire input could be written in ASCII: 110001010001011010011010100010101011100011101100101100110101110

The Language of the Problem Now we create the language of all graphs G that have Euler circuits. Let LEuler be the language {G | G has an Euler circuit}. Let MEuler be a Turing machine that decides LEuler.

The Language of the Problem Given a graph G, we solve the Euler circuit problem for G by letting MEuler decide whether G  LEuler.