Information AboutAlgorithm |
| CATEGORIES ABOUT ALGORITHM | |
| algorithms | |
| arabic words and phrases | |
| discrete mathematics | |
| mathematical logic | |
| theoretical computer science | |
|
In Mathematics and Computing , an algorithm is a procedure (a finite Set of well-defined instructions) for accomplishing some task which, given an initial state, will Terminate in a defined end-state. The Computational Complexity and efficient Implementation of the algorithm are important in computing, and this depends on suitable Data Structure s. Informally, 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 ). In most higher level programs, algorithms act in complex patterns, each using smaller and smaller sub-methods which are built up to the program as a whole. In most languages, they are isomorphic to functions or methods. The concept of an algorithm originated as a means of recording procedures for solving mathematical problems such as finding the common divisor of two numbers or multiplying two numbers. The concept was formalized in 1936 through Alan Turing 's Turing Machines and Alonzo Church 's Lambda Calculus , which in turn formed the foundation of Computer Science . Most algorithms can be directly implemented by Computer Program s; any other algorithms can at least in theory be ''simulated'' by computer programs. HISTORY The word ''algorithm'' comes from the name of the 9th century Persian mathematician Abu Abdullah Muhammad Bin Musa Al-Khwarizmi . The word '' Algorism '' originally referred only to the rules of performing Arithmetic using Hindu-Arabic Numerals but evolved via European Latin translation of al-Khwarizmi's name into ''algorithm'' by the 18th century. The word evolved to include all definite procedures for solving problems or performing tasks. 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 never completed his Analytical Engine the algorithm was never implemented on it. The lack of Mathematical Rigor in the "well-defined procedure" definition of algorithms posed some difficulties for mathematicians and Logic ians 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 that every method yet found for describing "well-defined procedures" advanced by other mathematicians could be emulated on a Turing machine (a statement known as the Church-Turing Thesis ). Nowadays, a formal criterion for an algorithm is that it is a procedure that can be implemented on a completely specified Turing machine or one of the equivalent Formalism s. Algorithms have also been used as a form to solve complex puzzles like the Rubik's Cube . FORMALIZATION OF ALGORITHMS Algorithms are essential to the way Computer s process information, because a Computer Program is essentially an algorithm that tells the computer what specific steps to perform (in what specific order) 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. 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 , but an algorithm requires the internal data only for specific operation sets called Abstract Data Type s. 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 by '' Flow 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 algorithms is the Assignment Operation , setting the value of a variable. It derives 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 an algorithm. Some writers restrict the definition of ''algorithm'' to procedures that eventually finish. Others include procedures that could run forever without stopping, arguing that some entity may be required to carry out such permanent tasks. In the latter case, success can no longer be defined in terms of halting with a meaningful output. Instead, terms of success that allow for unbounded output sequences must be defined. For example, an algorithm that verifies if there are more zeros than ones in an infinite random binary sequence must run forever to be effective. If it is implemented correctly, however, the algorithm's output will be useful: for as long as it examines the sequence, the algorithm will give a positive response while the number of examined zeros outnumber the ones, and a negative response otherwise. Success for this algorithm could then be defined as eventually outputting only positive responses if there are actually more zeros than ones in the sequence, and in any other case outputting any mixture of positive and negative responses. Summarizing the above discussion about what algorithm should consist.
Standardised notation Algorithms in computer science suffer somewhat by the proliferation of Computer Language s each with their own Syntax and basic methods. As a result, the usual standard is to write code either in C or Pseudo-code . In both cases annotation usually accompanies the code in the form of an accompanying document for longer algorithms, or in the form of C Style Comments embedded in the code. Some algorithms are built for purpose and it makes sense to use a more specific language. In such cases it is usual to formalise the algorithm by defining all of its basic functions, constants and variables before the algorithm. Implementation An algorithm is a set of steps to perform a computation. Most algorithms will be implemented as Computer Programs . They can be expressed in any notation including English for documenting and research purposes. A more preferred way is to embody (or sometimes called ''codify'') an algorithm by writing of its Pseudocode . Pseudocode representation avoids ambiguities that are common in English statements. The pseudocode can also be translated into particular programming language more straightforwardly. Algorithms are implemented not only as Computer Program s, but often also by other means, such as in a biological Neural Network (for example, the Human Brain implementing Arithmetic or an insect relocating food), in Electric Circuit s, or in a mechanical device. EXAMPLES One of the simplest algorithms is to find the largest number in an (unsorted) list of numbers. The solution necessarily requires looking at every number in the list, but only once at each. From this follows a simple algorithm, which can be stated in English as: # Let us assume the first item is largest. # Look at each of the remaining items in the list and make the following adjustment. #:a. If it is larger than the largest item we gathered so far, make a note of it. # The latest noted item is the largest in the list when the process is complete. Here is a more formal coding of the algorithm in Pseudocode : Input: A non-empty list of numbers ''L''. Output: The ''largest'' number in the list ''L''. ''largest'' ← ''L''0 for each ''item'' '''in''' the list ''L≥1'', '''do''' if the ''item'' > ''largest'', '''then''' ''largest'' ← the ''item'' return ''largest'' Here is a much simpler algorithm described somewhat formally but still in English instead of pseudocode. It determines if a given number ''n'' is even or odd: #BEGIN #Read the value of ''n''. #Divide ''n'' by 2 and store the remainder in ''rem''. #If ''rem'' is 0, go to step 7. #Print "''n'' is an odd number". #Go to step 8. #Print "''n'' is an even number". #END For a more complex example, see Euclid's Algorithm , which is one of the oldest algorithms. Algorithm analysis As it happens, most people who implement algorithms want to know how much of a particular resource (such as time or storage) is required for a given algorithm. Methods have been developed for the Analysis Of Algorithms to obtain such quantitative answers; for example, the algorithm above has a time requirement of O(''n''), using the Big O Notation with ''n'' as the length of the list. At all times the algorithm only needs to remember two values: the largest number found so far, and its current position in the input list. Therefore it is said to have a space requirement of ''O(1)''In this example the sizes of the numbers themselves could be unbounded and one could therefore argue that the space requirement is O(log ''n''). In practice, however, the numbers considered would be bounded and hence the space taken up each number is fixed.. (Note that the size of the inputs is not counted as space used by the algorithm.) Different algorithms may complete the same task with a different set of instructions in less or more time, space, or effort than others. For example, given two different recipes for making potato salad, one may have ''peel the potato'' before ''boil the potato'' while the other presents the steps in the reverse order, yet they both call for these steps to be repeated for all potatoes and end when the potato salad is ready to be eaten. 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 other implementation). In this sense, it resembles other mathematical disciplines in that the analysis focuses on the underlying principles of the algorithm, and not on any particular implementation. The pseudocode is simplest and abstract enough for such analysis. CLASSES There are various ways to classify algorithms, each with its own merits. Classification by implementation One way to classify algorithms is by implementation means.
Classification by design paradigm Another way of classifying algorithms is by their design methodology or paradigm. There is a certain number of paradigms, each different from the other. Furthermore, each of these categories will include many different types of algorithms. Some commonly found paradigms include:
# Probabilistic Algorithm s are those that make some choices randomly (or pseudo-randomly); for some problems, it can in fact be proven that the fastest solutions must involve some Randomness . # Genetic Algorithm s attempt to find solutions to problems by mimicking biological Evolution ary processes, with a cycle of random mutations yielding successive generations of "solutions". Thus, they emulate reproduction and "survival of the fittest". In Genetic Programming , this approach 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 an optimal solution, but an approximate solution where the time or resources to find a perfect solution are not practical. An example of this would be Local Search , Taboo Search , or 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, the idea being that the random element will be decreased as the algorithm settles down to a solution. Classification by field of study Every field of science has its own problems and needs efficient algorithms. Related problems in one field are often studied together. Some example classes are Search Algorithm s, Sort Algorithm s, Merge Algorithm s, Numerical Algorithms , Graph Algorithms , String Algorithms , Computational Geometric Algorithms , Combinatorial Algorithms , Machine Learning , Cryptography , Data Compression algorithms and Parsing Techniques . ''See also:'' List Of Algorithms for more details. Some of these fields overlap with each other and advancing in algorithms for one field causes advancement in many fields and sometimes completely unrelated fields. For example, dynamic programming is originally invented for optimisation in resource consumption in industries, but it is used in solving broad range of problems in many fields. Classification by complexity Some algorithms complete in linear time, and some complete in exponential amount of time, and some never complete. One problem may have multiple algorithms, and some problems may have no algorithms. Some problems have no known efficient algorithms. There are also mappings from some problems to other problems. So computer scientists found it is suitable to classify the problems rather than algorithms into equivalence classes based on the complexity. ''See also:'' Complexity Class es for more details. LEGAL ISSUES Some countries allow algorithms to be Patented when embodied in software or in hardware. Patents have long been a controversial issue (see, for example, the Software Patent Debate ). Some countries do not allow certain algorithms, such as cryptographic algorithms, to be Exported from that country. EXAMPLES OF USEFUL SIMPLE ALGORITHMS SEE ALSO
NOTES REFERENCES EXTERNAL LINKS
|
|
|