| ||

## Algorithms(algorithms)
An The concept of an algorithm is often illustrated by the example of a recipe ,although many algorithms are much more complex; algorithms often have steps that repeat ( iterate ) or require decisions (such as logic or comparison ) until the task is completed. Correctly performing an algorithm will notsolve a problem if the algorithm is flawed or not appropriate to the problem. For example, performing the potato salad algorithmwill fail if there are no potatoes present, even if all the motions of preparing the salad are performed as if the potatoes werethere.
Different algorithms may complete the same task with a different set of instructions in more or less time, space, or effortthan others. For example, given two different recipes for making potato salad, one may have In some countries, such as the USA, some algorithms can effectively be patented if aphysical embodiment is possible (for example, a multiplication algorithm may be embodied in the arithmetic unit of amicroprocessor).
## Formalized algorithmsAlgorithms are essential to the way computers process information, because a computer program is essentially an algorithm that tells thecomputer what specific steps to perform (in what specific order) in order to carry out a specified task, such as calculatingemployeesâ€™ paychecks or printing studentsâ€™ report cards. Thus, an algorithm can be considered to be any sequence ofoperations which can be performed by a Turing-complete system. Typically, when an algorithm is associated with processing information, data is read from an input source or device, writtento an output sink or device, and/or stored for further use. Stored data is regarded as part of the internal state of the entityperforming the algorithm. For any such computational process, the algorithm must be rigorously defined: specified in the way it applies in all possiblecircumstances that could arise. That is, any conditional steps must be systematically dealt with, case-by-case; the criteria foreach 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 thefunctioning of the algorithm. Instructions are usually assumed to be listed explicitly, and are described as starting 'from thetop' and going 'down to the bottom', an idea that is described more formally by So far, this discussion of the formalisation of an algorithm has assumed the premises of imperative programming . This is the most common conception, andit attempts to describe a task in discrete, 'mechanical' means. Unique to this conception of formalized algorithms is the assignment operation , setting the value of a variable. Itderives from the intuition of 'memory' as a scratchpad. There is an example below of such an assignment. See functional programming and logic programming for alternate conceptions of what constitutes analgorithm. ## Implementing algorithmsAlgorithms are not only implemented as computer programs , butoften also by other means, such as in a biological neural network (for example, the human brain implementing arithmetic or an insect relocating food), or in electric circuits or in a mechanical device.
The
analysis and study of algorithms
is onediscipline of
computer science
, and is often practiced abstractly(without the use of a specific
programming language
orother implementation). In this sense, it resembles other mathematical disciplines in that the analysis focuses on the underlyingprinciples of the algorithm, and not on any particular implementation. One way to embody (or sometimes
Some writers restrict the definition of ## ExampleHere is a simple example of an algorithm. Imagine you have an unsorted list of random numbers. Our goal is to find the highest number in this list. Upon first thinkingabout the solution, you will realise that you must look at every number in the list. Upon further thinking, you will realise thatyou need to look at each number only once. Taking this into account, here is a simple algorithm to accomplish this: - Pretend the first number in the list is the largest number.
- Look at the next number, and compare it with this largest number.
- Only if this next number is larger, then keep that as the new largest number.
- Repeat steps 2 and 3 until you have gone through the whole list.
And here is a more formal coding of the algorithm in a pseudocode that issimilar to most programming languages : Given: a list "List" largest = List[1] counter = 2 while counter <= length(List): if List[counter] > largest: largest = List[counter] counter = counter + 1 print largest Notes on notation: *=*as used here indicates assignment. That is, the value on the right-hand side of the expression is assigned to thecontainer (or variable) on the left-hand side of the expression.*List[counter]*as used here indicates the counter^{th}element of the list. For example: if the value of*counter*is 5, then*List[counter]*refers to the 5^{th}element of the list.*<=*as used here indicates 'less than or equal to'
Note also the algorithm assumes that the list contains at least one number. It will fail when presented an empty list. Mostalgorithms have similar assumptions on their inputs, called pre-conditions .
As it happens, most people who implement algorithms want to know how much of a particular resource (such as time or storage) agiven algorithm requires. Methods have been developed for the
analysis of algorithms
to obtain such quantitative answers; for example, the algorithm above has atime requirement of O( ## History
The word The first case of an algorithm written for a computer was Ada Byron 's notes on the analytical engine written in 1842 , for which she is considered by many to be the world's first programmer . However, since Charles Babbage nevercompleted his analytical engine the algorithm was neverimplemented on it. The lack of mathematical rigor in the "well-definedprocedure" definition of algorithms posed some difficulties for mathematicians and logicians of the 19th and early 20th centuries . This problem was largely solved with the description of the Turing machine , an abstract model of a computer formulated by Alan Turing , and the demonstration thatevery method yet found for describing "well-defined procedures" advanced by other mathematicians could be emulated on a Turingmachine (a statement known as the Church-Turingthesis ). Nowadays, a formal criterion for an algorithm is that it is a procedure that can be implemented on a completely-specifiedTuring machine or one of the equivalent formalisms . Turing's initial interest wasin the halting problem : deciding when an algorithm describes aterminating procedure. In practical terms computational complexity theory matters more: it includes the puzzling problem of thealgorithms called NP-complete , which are generally presumed to take more thanpolynomial time. ## Classes of algorithmsThere are many ways to classify algorithms, and the merits of each classification have been the subject of ongoing debate. One way of classifying algorithms is by their design methodology or paradigm. There is a certain number of paradigms, eachdifferent from the other. Furthermore, each of these categories will include many different types of algorithms. Some commonlyfound paradigms include: **Divide and conquer**. A divide-and-conquer algorithm reduces an instance of a problem to one or more smaller instancesof the same problem (usually recursively ), until the instances are small enoughto be directly expressible in the programming language employed (what is 'direct' is often discretionary).**Dynamic programming**. When a problem shows optimal substructure, i.e when the optimal solution to a problemconsists of optimal solutions to subproblems (for instance the shortest path between two vertices on a weighted graph consists of the shortest path between all the vertices inbetween.) You solve such a problem bottom-up by solving the simplest problems first and then procceding to increasingly difficultproblems until you have solved the original problem. This is called a dynamic programming algorithm .**The greedy method**. A greedy algorithm issimilar to a dynamic programming algorithm , but thedifference is that at each stage you don't have to have the solutions to the subproblems, you can make a "greedy" choice of whatlooks best for the moment.**Linear programming**. When you solve a problem using linear programming you put the program into a number of linear inequalities and then try to maximize (or minimize)the inputs. Many problems (such as the maximum flow for directed graphs ) canbe stated in a linear programming way, and then be solved by a 'generic' algorithm such as the Simplex algorithm .**Search and enumeration**. Many problems (such as playing chess ) can bemodelled as problems on graphs . A graph exploration algorithm specifies rules formoving around a graph and is useful for such problems. This category also includes the search algorithms and backtracking .**The probabilistic and heuristic paradigm**. Algorithms belonging to this class fit the definition of analgorithm more loosely. Probabilistic algorithms arethose that make some choices randomly (or pseudo-randomly); for some problems, it can in fact be proved that the fastestsolutions must involve some randomness. Genetic algorithms attempt to find solutions to problems by mimicking biological evolutionary processes, with a cycle of random mutations yielding successive generations of 'solutions'. Thus, they emulate reproduction and"survival of the fittest". In genetic programming , thisapproach is extended to algorithms, by regarding the algorithm itself as a 'solution' to a problem. Also there are heuristic algorithms, whose general purpose is not to find a final solution, but anapproximate solution where the time or resources to find a perfect solution are not practical. An example of this would be simulated annealing algorithms, a class of heuristic probabilistic algorithms that vary the solution of a problem by a random amount. The name'simulated annealing' alludes to the metallurgic term meaning the heating and cooling of metal to achieve freedom from defects.The purpose of the random variance is to find close to globally optimal solutions rather than simply locally optimal ones, theidea being that the random element will be decreased as the algorithm settles down to a solution.
Another way to classify algorithms is by implementation. A recursive algorithm is one that invokes (makes reference to) itself repeatedly until a certaincondition matches, which is a method common to functionalprogramming . Algorithms are usually discussed with the assumption that computers execute one instruction of an algorithm at atime. Those computers are sometimes called serial computers. An algorithm designed for such an environment is called a serialalgorithm, as opposed to parallel algorithms , which takeadvantage of computer architectures where several processors can work on a problem at the same time. The various heuristicalgorithm would probably also fall into this category, as their name (e.g. a genetic algorithm) describes its implementation. A list of algorithms discussed in Wikipedia isavailable. ## See also- Algorism
- Bulletproof algorithms
- Numerical analysis
- Cryptographic algorithms
- Sort algorithms
- Search algorithms
- Merge algorithms
- String algorithms
- List of algorithms
- Timeline of algorithms
- Data structure
- Genetic algorithms
- Randomised algorithms
- Computability logic
## References-
Donald E Knuth
:
*The Art of Computer Programming*, Vol 1-3, Addison Wesley 1998. Widely heldas a definitive reference. ISBN0201485419 . - Important algorithm-related publications
## External links- Gaston H. Gonnet and Ricardo Baeza-Yates: Example programs from
*Handbook of Algorithms and Data Structures.*Free source code for lots of importantalgorithms. - Dictionary of Algorithms and DataStructures . "This is a dictionary of algorithms,algorithmic techniques, data structures, archetypical problems, and related definitions."
- Numerical Recipes
algoritms, list, algroithms, example, , number, algorithm, solution, algoritmhs, counter, lagorithms, steps, algorthms, defined, algoirthms, many, aglorithms, computer, alorithms, th, alogrithms, until, algorithsm, optimal, algorihms, solutions, algrithms, called, algoithms, computers, algoriths, turing, algorihtms, analysis, lgorithms, genetic, agorithms, implementation, algortihms, include This article is completely or partly from Wikipedia - The Free Online Encyclopedia. Original Article. The text on this site is made available under the terms of the GNU Free Documentation Licence. We take no responsibility for the content, accuracy and use of this article. Anoca.org Encyclopedia 0.01s |