Definition of Algorithm

download Definition of Algorithm

of 11

Transcript of Definition of Algorithm

  • 7/29/2019 Definition of Algorithm

    1/11

    2/27/13 Definition of algorithm

    www.scriptol.com/programming/algorithm-definition.php

    Search

    Algorithms

    List of algorithms

    Amazing algorithms

    Languages

    List of languages

    History

    Techniques

    Ajax frameworks

    Design principles

    Building a CMS

    Web app building

    Tutorials

    Scripts & tools

    Programming tools

    FTP Synchronizer

    ARA RSS Editor

    RSS Reader

    Definition of algorithm

    An algorithm is deterministic automaton for accomplishing a goal

    which, given an initial state, will terminate in a defined end-state.

    The efficiency of implementation of the algorithm depends upon

    speed, size, resources consumption. We will discuss definitions,

    classifications and the history.

    Contents

    What is an algorithm?

    Definitions of algorithms

    Blass and Gurevich

    Boolos and Jeffrey

    Knuth

    Markov

    Minsky

    Stone

    Some issues

    Expressing algorithms

    Must an algorithm halt?

    Algorithm analysis

    Simple example: multiplication

    References

    What is analgorithm?

    No agreed-to definition of "algorithm" exists.

    A simple definition:A set of instructions for solving a problem.

    The algorithm is either implemented by a program or simulated by

    a program. Algorithms often have steps that iterate (repeat ) or

    require decisions such as logic or comparison.

    An very simple example of an algorithm is multiplying two

    Ajax CMS Design Getting star ted Programming RSS Scr iptol Scr ipts SEO SQL Software

    Wordpress

    http://www.scriptol.com/programming/algorithm-definition.php#examplehttp://www.scriptol.com/rss/rss-reader.phphttp://www.scriptol.com/rss/ara.phphttp://www.scriptol.com/programming/algorithm-definition.php#examplehttp://www.scriptol.com/programming/algorithm-definition.php#analysishttp://www.scriptol.com/programming/algorithm-definition.php#halthttp://www.scriptol.com/programming/algorithm-definition.php#Stonehttp://www.scriptol.com/programming/algorithm-definition.php#Markovhttp://www.scriptol.com/programming/algorithm-definition.php#booloshttp://www.scriptol.com/programming/algorithm-definition.php#Blasshttp://www.scriptol.com/programming/algorithm-definition.php#definitionshttp://www.scriptol.com/programming/algorithm-definition.php#what-is-algorithmhttp://www.scriptol.com/getting-started/http://www.scriptol.com/http://www.scriptol.com/programming/http://www.scriptol.com/programming/http://www.scriptol.com/programming/http://www.scriptol.com/http://www.scriptol.com/rss/http://www.scriptol.com/http://www.scriptol.com/compiler/http://www.scriptol.com/http://www.scriptol.com/wordpress/http://www.scriptol.com/software/http://www.scriptol.com/sql/http://www.scriptol.com/seo/http://www.scriptol.com/scripts/http://www.scriptol.com/compiler/http://www.scriptol.com/rss/http://www.scriptol.com/programming/http://www.scriptol.com/getting-started/http://www.scriptol.com/design/http://www.scriptol.com/cms/http://www.scriptol.com/ajax/http://www.scriptol.com/programming/algorithm-definition.php#examplehttp://www.scriptol.com/programming/algorithm-definition.php#Referenceshttp://www.scriptol.com/programming/algorithm-definition.php#examplehttp://www.scriptol.com/programming/algorithm-definition.php#analysishttp://www.scriptol.com/programming/algorithm-definition.php#halthttp://www.scriptol.com/programming/algorithm-definition.php#Expressing-algorithmshttp://www.scriptol.com/programming/algorithm-definition.php#problemshttp://www.scriptol.com/programming/algorithm-definition.php#Stonehttp://www.scriptol.com/programming/algorithm-definition.php#Minskyhttp://www.scriptol.com/programming/algorithm-definition.php#Markovhttp://www.scriptol.com/programming/algorithm-definition.php#Knuthhttp://www.scriptol.com/programming/algorithm-definition.php#booloshttp://www.scriptol.com/programming/algorithm-definition.php#Blasshttp://www.scriptol.com/programming/algorithm-definition.php#definitionshttp://www.scriptol.com/programming/algorithm-definition.php#what-is-algorithmhttp://www.scriptol.com/rss/rss-reader.phphttp://www.scriptol.com/rss/ara.phphttp://www.scriptol.com/scripts/php-ftp-synchronizer.phphttp://www.scriptol.com/programming/tools.phphttp://www.scriptol.com/tutorials.phphttp://www.scriptol.com/ajax/ria.phphttp://www.scriptol.com/cms/building-a-cms.phphttp://www.scriptol.com/design/web-design-essential-principles.phphttp://www.scriptol.com/ajax/frameworks.phphttp://www.scriptol.com/programming/history.phphttp://www.scriptol.com/programming/list-programming-languages.phphttp://www.scriptol.com/programming/graphic-algorithms.phphttp://www.scriptol.com/programming/list-algorithms.phphttp://www.scriptol.com/
  • 7/29/2019 Definition of Algorithm

    2/11

    2/27/13 Definition of algorithm

    www.scriptol.com/programming/algorithm-defin ition.php 2

    numbers: on first computers with limited processors, this was

    accomplished by a routine that in a number of loop based on the

    first number adds the second number. The algorithm translates a

    method into computer commands.

    Algorithms are essential to the way computers process information,

    because a computer program is essentially an algorithm that tells

    the computer what specific steps to perform (in what specificorder) in order to carry out a specified task, such as calculating

    employees' paychecks or printing students' report cards. Thus, an

    algorithm can be considered to be any sequence of operations

    which can be performed by a Turing-complete system. Authors

    who assert this thesis include Savage (1987) and Gurevich (2000):

    ...Turing's informal argument in favor of his thesis justifies

    a stronger thesis: every algorithm can be simulated by a

    Turing machine" ...according to Savage [1987], analgorithm is a computational process defined by a Turing

    machine.

    Typically, when an algorithm is associated with processing

    information, data is read from an input source or device, written to

    an output sink or device, and/or stored for further processing.

    Stored data is regarded as part of the internal state of the entity

    performing the algorithm. In practice, the state is stored in a data

    structure.

    For any such computational process, the algorithm must be

    rigorously defined: specified in the way it applies in all possible

    circumstances that could arise. That is, any conditional steps must

    be systematically dealt with, case-by-case; the criteria for each

    case must be clear (and computable).

    Because an algorithm is a precise list of precise steps, the order of

    computation will almost always be critical to the functioning of the

    algorithm. Instructions are usually assumed to be listed explicitly,and are described as starting 'from the top' and going 'down to the

    bottom', an idea that is described more formally byflow of

    control.

    So far, this discussion of the formalization of an algorithm has

    assumed the premises of imperative programming. This is the most

    common conception, and it attempts to describe a task in discrete,

    'mechanical' means. Unique to this conception of formalized

    http://www.scriptol.com/programming/algorithm-definition.php#examplehttp://www.scriptol.com/programming/algorithm-definition.php#example
  • 7/29/2019 Definition of Algorithm

    3/11

    2/27/13 Definition of algorithm

    www.scriptol.com/programming/algorithm-definition.php 3

    algorithms is the assignment operation, setting the value of a

    variable. It derives from the intuition of 'memory' as a scratchpad.

    For some alternate conceptions of what constitutes an algorithm

    see functional programming and logic programming.

    Definitions of algorithms

    Blass and Gurevich

    Blass and Gurevich describe their work as evolved from

    consideration of Turing machines, Kolmogorov-Uspensky

    machines (KU machines), Schnhage machine (storage

    modification machine SMM), and pointer machines (linking

    automata) as defined by Knuth. The work of Gandy and Markov

    are also described as influential precursors.

    Gurevich offers a 'strong' definition of an algorithm (that is

    summarized here):

    The Turing's informal argument in favor of his thesis

    justifies a stronger thesis: every algorithm can be simulated

    by a Turing machine. In practice, it would be ridiculous.

    Can one generalize Turing machines so that any algorithm,

    never mind how abstract, can be modeled by a generalized

    machine? But suppose such generalized Turing machines

    exist. What would their states be?A first-order structure. Aparticular small instruction set suffices in all cases.

    Computation could be an evolution of the state, could be

    nondeterministic, interact with its environment, could be

    parallel and multi-agent, could have dynamic semantics.

    The two underpinings of thier work are: Turing's thesis

    andthe notion of first order structure of Tarski.

    The above phrase computation as an evolution of the state

    differs markedly from the definition of Knuth and Stone, the"algorithm" as a Turing machine program. Rather, it corresponds

    to what Turing called the complete configuration, and includes

    both the current instruction (state) andthe status of the tape.

    Kleene (1952) shows an example of a tape with 6 symbols on it,

    all other squares are blank, and how to "Gdelize" its combined

    table-tape status.

    Boolos and Jeffrey

  • 7/29/2019 Definition of Algorithm

    4/11

    2/27/13 Definition of algorithm

    www.scriptol.com/programming/algorithm-definition.php 4

    Their definition is:

    "Explicit instructions for determining the nth member of

    a set, for arbitrary finite n. Such instructions are to be

    given quite explicitly, in a form in which they could be

    followed by a computing machine, or by a human who

    is capable of carrying out only very elementary

    operations on symbols."

    Knuth

    Knuth (1968, 1973) has given a list of five properties that are

    widely accepted as requirements for an algorithm:

    1. Finiteness: "An algorithm must always terminate after a

    fini te number of steps"

    2. Definiteness: "Each step of an algorithm must be preciselydefined; the actions to be carried out must be rigorously

    and unambiguously specified for each case"

    3. Input: "...quantities which are given to it initially before

    the algorithm begins. These inputs are taken from specified

    sets of objects"

    4. Output: "...quantities which have a specified relation to the

    inputs"

    5. Effectiveness: "... all of the operations to be performed in

    the algorithm must be sufficiently basic that they can inprinciple be done exactly and in a finite length of time by a

    man using paper and pencil"

    Knuth offers as an example the Euclidean algorithm for

    determining the greatest common divisor of two natural numbers.

    Knuth admits that, while his description of an algorithm may be

    intuitively clear, it lacks formal rigor, since it is not exactly clear

    what "precisely defined" means, or "rigorously and

    unambiguously specified" means, or "sufficiently basic", and soforth. He makes an effort in this direction in his first volume where

    he defines in detailwhat he calls the "machine language" for his

    "mythical MIX... the world's first polyunsaturated computer".

    Many of the algorithms in his books are written in the MIX

    language. He also uses tree diagrams, flow diagrams and state

    diagrams.

    Markov

  • 7/29/2019 Definition of Algorithm

    5/11

    2/27/13 Definition of algorithm

    www.scriptol.com/programming/algorithm-definition.php 5

    A. A. Markov (1954) provided the following definition of

    algorithm:

    1. In mathematics, "algorithm" is commonly understood to

    be an exact prescription, defining a computational process,

    leading from various initial data to the desired result....

    The following three features are characteristic ofalgorithms and determine their role in mathematics:

    a) the precision of the prescription, leaving no place to

    arbitrariness, and its universal comprehensibility -- the

    definiteness of the algorithm;

    b) the possibility of starting out with initial data, which

    may vary within given limits -- the generality of the

    algorithm;

    c) the orientation of the algorithm toward obtaining some

    desired result, which is indeed obtained in the end withproper initial data -- the conclusiveness of the algorithm.

    He admitted that this definition "does not pretend to mathematical

    precision". His 1954 monograph was his attempt to define

    algorithm more accurately; he saw his resulting definition -- his

    "normal" algorithm -- as "equivalent to the concept of a recursive

    function". His definition included four major components:

    1. Separate elementary steps, each of which will be performed

    according to one of the given substitution rules.2. Steps of local nature (the algorithm won't change more than

    a certain number of symbols).

    3. The scheme of the algorithm is a list of rules for the

    substitution formulas.

    4. A means to distinguish a concluding substitution (a final

    state).

    In his Introduction Markov observed that the entire significance for

    mathematics of efforts to define algorithm more precisely wouldbe in connection with the problem of a constructive foundation for

    mathematics.

    Minsky

    Minsky (1967) asserts that an algorithm is an effective procedure

    and replaces further in his text algorithm by effective procedure.

    The term is also used by Knuth. Here is its definition of effective

  • 7/29/2019 Definition of Algorithm

    6/11

    2/27/13 Definition of algorithm

    www.scriptol.com/programming/algorithm-definition.php 6

    procedure:

    A set of rules which tell us, from moment to moment,

    precisely how to behave.

    But he recognizes that this is subject to a criticism:

    The interpretation of the rules is left to depend on someperson or agent.

    He made a refinement: to specify, along with the statement of the

    rules, the details of the mechanism that is to interpret them. To

    avoid the cumbersome process of having to do this over again for

    each individual procedure he hopes to identify a reasonably

    uniform family of rule-obeying mechanisms. Here is his

    formulation:

    (1) a language in which sets of behavioral rules are to beexpressed, and

    (2) a single machine which can interpret statements in the

    language and thus carry out the steps of each specified

    process.

    In the end, though, he still worries that "there remains a subjective

    aspect to the matter. Different people may not agree on whether a

    certain procedure should be called effective".

    But Minsky is undeterred. He immediately introduces "Turing's

    Analysis of Computation Process". He quotes what he calls

    Turing's thesis:

    Any process which could naturally be called an effective

    procedure can be realized by a Turing machine.

    (This is also called Church's thesis).

    After an analysis of "Turing's Argument" he observes that

    equivalence of many intuitive formulations of Turing, Church,

    Kleene, Post, and Smullyan "leads us to suppose that there is

    really here an objective or absolute notion".

    Stone

    Stone (1972) and Knuth (1968, 1973) were professors at Stanford

    University at the same time so it is not surprising if there are

    similarities in their definitions:

  • 7/29/2019 Definition of Algorithm

    7/11

    2/27/13 Definition of algorithm

    www.scriptol.com/programming/algorithm-definition.php 7

    To summarize ... we define an algorithm to be a set of rules

    that precisely defines a sequence of operations such that

    each rule is effective anddefinite and such that the

    sequence terminates in a finite time.

    Stone is noteworthy because of his detailed discussion of what

    constitutes an effective rule for his robot, or person-acting-as-

    robot, must have some information and abilities within them, and ifnot the information and the ability must be provided in "the

    algorithm":

    For people to follow the rules of an algorithm, the rules

    must be formulated so that they can be followed in a robot-

    like manner, that is, without the need for thought...

    however, i f the instructions [to solve the quadratic

    equation, his example] are to be obeyed by someone who

    knows how to perform arithmetic operations but does notknow how to extract a square root, then we must also

    provide a set of rules for extracting a square root in order

    to satisfy the definition of algorithm.

    (...) not all instructions are acceptable, because they may

    require the robot to have abilities beyond those that we

    consider reasonable.

    He gives the example of a robot confronted with the question: "Is

    Henry VIII is a King of England", print 1 if yes and 0 if no, but therobot has not been previously provided with this information. And

    worse, if the robot is asked if Aristotle was a King of England and

    the robot only had been provided with five names, it would not

    know how to answer. Thus:

    An intuitive definition of an acceptable sequence of

    instructions is one in which each instruction is precisely

    defined so that the robot is guaranteed to be able to obey it.

    After providing us with his definition, Stone introduces the Turingmachine model and states that the set of five-tupes that are the

    machine's instructions is an algorithm... known as a Turing

    machine program. Puis he says that a computation of a Turing

    machine is describedby stating:

    1. The tape alphabet

    2. The form in which the parameters are presented on the

    tape

  • 7/29/2019 Definition of Algorithm

    8/11

    2/27/13 Definition of algorithm

    www.scriptol.com/programming/algorithm-definition.php 8

    3. The initial state of the Turing machine

    4. The form in which answers will be represented on the

    tape when the Turing machine halts

    5. The machine program.

    This is in the spirit of Blass and Gurevich.

    Some issues

    Expressing algorithms

    Algorithms can be expressed in many kinds of notations:

    - Natural language expressions of algorithms tend to be verbose

    and ambiguous, and are rarely used for complex or technical

    algorithms.

    - Pseudocode and flowcharts are structured ways to express

    algorithms that avoid the ambiguities, while remaining independentof a particular implementation language.

    - Programming languages are primarily intended for expressing

    algorithms in a form that can be executed by a computer, but are

    often used as a way to define or document algorithms.

    Must an algorithm halt?

    Some writers restrict the definition ofalgorithm to procedures that

    eventually finish. Others, as Kleene, include procedures that could

    run forever without stopping. Such a procedure has been called a

    "computational method" by Knuth or "calculation procedure or

    algorithm" by Kleene. However, Kleene notes that such a method

    must eventually exhibit "some object".

    Minksy (1967) makes the observation that, if an algorithm hasn't

    "terminated" then how can we answer the question: "Will it

    terminate with the correct answer?'"

    Thus the answer is: undecidable. We can never know, nor can wedo an analysis beforehand to find out. The analysis of algorithms

    for their likelihood of termination is called "Termination analysis".

    Algorithm analysis

    The terms "analysis of algorithms" was coined by Knuth. Most

    people who implement algorithms want to know how much of a

    particular resource, such as time or storage, is required for the

  • 7/29/2019 Definition of Algorithm

    9/11

    2/27/13 Definition of algorithm

    www.scriptol.com/programming/algorithm-definition.php 9

    execution. Methods have been developed for the analysis of

    algorithms to obtain such quantitative answers.

    The analysis and study of algorithms is one discipline of computer

    science, and is often practiced abstractly (without the use of a

    specific programming language or hardware). But the Scriptol code

    is portable, simple and abstract enough for such analysis.

    Simple example: multiplication

    int multiply(int x, int y)

    int sum = 0

    while y > 0

    sum + x

    let y - 1

    return sum

    int a = 5

    int b = 7

    print a,"x", b, "=", multiply(a, b)

    References

    Martin Davis. The Undecidable: Basic Papers On

    Undecidable Propostions, Unsolvable Problems and

    Computable Functions. New York: Raven Press, 1965.

    Davis gives commentary before each article.Yuri Gurevich. Sequential Abstract State Machines

    Capture Sequential Algorithms, ACM Transactions on

    Computational Logic, Vol 1, no 1 (July 2000), pages 77-111.

    Includes bibliography of 33 sources.

    A. A. Markov. Theory of algorithms. Imprint Moscow,

    Academy of Sciences of the USSR, 1954 . Original title:

    Teoriya algerifmov.

    Marvin Minsky. Computation: Finite and Infinite

    Machines, First, Prentice-Hall, Englewood Cliffs, NJ, 1967.

    Harold S. Stone.Introduction to Computer Organization

    and Data Structures, 1972, McGraw-Hill, New York.

    Cf in particular the first chapter titled:Algorithms, Turing

    Machines, and Programs.

    See also:

    The list of algorithms.

    Algorithms

    http://www.scriptol.com/programming/list-algorithms.phphttp://research.microsoft.com/en-us/um/people/gurevich/Opera/141.pdf
  • 7/29/2019 Definition of Algorithm

    10/11

    2/27/13 Definition of algorithm

    www.scriptol.com/programming/algorithm-definition.php 10

    Like

    M Subscribe by email S RSS

    Sort by oldest first

    Definition of algorithm - Classification - History of

    algorithmics - List of algorithms - Sieve of Eratosthenes -

    Fibonacci numbers

    TweetTweet Like 19

    Showing 3 comments

    ShareShare

    1 person liked this.

    LoginAdd New Comment

    Type your comment here.

    not getting it clearly

    Momirao555

    fine and thanks for.........

    azad

    please can you details information in finitness,

    difinitness, effectiveness and input, output

    azad

    http://disqus.com/guest/79adbe36f80767c99dcc9179144f43a5/http://disqus.com/guest/79adbe36f80767c99dcc9179144f43a5/http://disqus.com/guest/c8c3628d2e4322168c79fde465672fb0/http://www.scriptol.com/programming/algorithm-definition.php#http://www.scriptol.com/programming/algorithm-definition.php#http://www.scriptol.com/programming/fibonacci.phphttp://www.scriptol.com/programming/sieve.phphttp://www.scriptol.com/programming/list-algorithms.phphttp://www.scriptol.com/programming/algorithm-history.phphttp://www.scriptol.com/programming/algorithms-classification.phphttp://www.scriptol.com/programming/algorithm-definition.phphttps://twitter.com/intent/tweet?original_referer=http%3A%2F%2Fwww.scriptol.com%2Fprogramming%2Falgorithm-definition.php&text=Definition%20of%20algorithm&tw_p=tweetbutton&url=http%3A%2F%2Fwww.scriptol.com%2Fprogramming%2Falgorithm-definition.phphttp://scriptol.disqus.com/definition_of_algorithm/latest.rsshttp://www.scriptol.com/programming/algorithm-definition.php#http://www.scriptol.com/programming/algorithm-definition.php#http://www.scriptol.com/programming/algorithm-definition.php#http://www.scriptol.com/programming/algorithm-definition.php#
  • 7/29/2019 Definition of Algorithm

    11/11

    2/27/13 Definition of algorithm

    2006-2011 Scriptol.com

    http://www.scriptol.com/programming/