1 / 7

The definition of algorithm

CSC 4170 Theory of Computation. The definition of algorithm. Section 3.3. 3.3.a. The intuitive notion of algorithms: An algorithm (procedure, recipe) is a collection of simple instructions for carrying out some task. Algorithms. Examples:

primo
Download Presentation

The definition of algorithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 4170 Theory of Computation The definition of algorithm Section 3.3

  2. 3.3.a The intuitive notion of algorithms: An algorithm (procedure, recipe) is a collection of simple instructions for carrying out some task. Algorithms • Examples: • The elementary school algorithms for adding, subtracting, multiplying, • etc.; • Converting an NFA to an equivalent DFA, or a RE to NFA, or an • NFA to RE, etc.; • Calculating students’ GPAs; • Sorting algorithms; • Any other procedures Dr. Levitin taught you. To carry out an algorithm, you only need to mechanically (blindly) follow its instructions. No understanding of the objects you are manipulating, no understanding of what you are doing is needed! We need a strict mathematical definition of an algorithm. The above “definition” obviously does not qualify.

  3. 3.3.b The structure of an algorithm: Input(s) Output or Input(s) Yes (accept) or No (reject) Algorithms should deal with strings The attempt to formalize the notion of algorithm should start from strictly specifying what kind of objects can be inputs/outputs. These are going to be only. strings No loss of generality: non-string objects can be easily represented with strings. A tuple of such objects can also be represented with a (one single) string. After all, computers exclusively deal with strings --- strings over the alphabet {0,1} !

  4. 3.3.c Encoding Encoding--- representing objects as strings in some standard way. There are usually many ways to encode; as one encoding can be easily (algorithmically) converted into another, it does not matter which encoding we choose. Encoding numbers:0,1,2,3,…,34,…, or 0,1,10,11,…,100010,… Encoding pairs of numbers:(4,2), (1,3), …, or 4#2, 1#3,…, or aaabb, abbb, … Encoding people:“David Stewart”, “Dongfei Wei”, …, or “Stewart, David”, “Wei, Dungfei”, or 315-21-5541, 326-11-1521… Encoding assembly language instructions: Their machine language equivalents. If O is an object, <O> will stand for a (the) encoding of O.

  5. 3.3.d Encoding graphs 1 2 3 G = <G> = (1,2,3,4,5)((1,4),(1,5),(2,3),(4,5)) 4 5 Algorithm M for checking if a graph is connected: M = “On input <G>, the encoding of a graph G: 1. Select the first node of G and mark it. 2. Repeat the following stage until no new nodes are marked: 3. For each node in G, mark it if it is attached by an edge to a node that is already marked. 4. Scan all the nodes of G to determine whether they all are marked. If they are, accept; otherwise reject.”

  6. 3.3.e The Church-Turing thesis The Church-Turing thesis: (the intuitive notion of) Algorithm Turing machine = It can never be mathematically proven! Importance: Without the Church-Turing thesis, you can never prove that a certain problem has no algorithmic solution. Example - Hilbert’s 10th problem (see page 154).

  7. 3.3.f 1. Formal description: The TM is fully described, say, by giving a transition diagram, or list of states, input/tape alphabets, a table for the transition function. Examples: Slides 3.1.b, 3.1.f, etc. The three levels of TM descriptions 2. Implementation description: English is used to describe the way that the machine moves its head and stores data on its tape. Details of states or transition functions are not given. Example: Slide 3.1.h 3. High-level description: English is used to describe the algorithm, without worrying about implementation-level details. There is no mention of head, tape etc. Example: Slide 3.3d; All the algorithms taught in CSC 8301

More Related