Array ( [0] => {{Short description|Sequence of operations for a task}} [1] => {{Redirect|Algorithms|the subfield of computer science|Analysis of algorithms|other uses|Algorithm (disambiguation)}} [2] => {{Use mdy dates|date=September 2017}} [3] => {{Copyedit|date=April 2024}} [4] => {{Essay|date=April 2024}} [5] => [[File:GCD through successive subtractions.svg|thumb|Flowchart of using successive subtractions to find the [[greatest common divisor]] of number ''r'' and ''s''|alt=In a loop, subtract the larger number against the smaller number. Halt the loop when the subtraction will make a number negative. Assess two numbers whether one of them equal to zero or not. If yes, take the other number as the greatest common divisor. If no, put the two number in the subtraction loop again.]] [6] => In [[mathematics]] and [[computer science]], an '''algorithm''' ({{IPAc-en|audio=en-us-algorithm.ogg|ˈ|æ|l|ɡ|ə|r|ɪ|ð|əm}}) is a [[mwod:finite|finite]] sequence of [[Rigour#Mathematics|mathematically rigorous]] instructions, typically used to solve a class of specific [[Computational problem|problem]]s or to perform a [[computation]].{{Cite web|url=https://www.merriam-webster.com/dictionary/algorithm|title=Definition of ALGORITHM|work=Merriam-Webster Online Dictionary |language=en |access-date=2019-11-14 |archive-url=https://web.archive.org/web/20200214074446/https://www.merriam-webster.com/dictionary/algorithm |archive-date=February 14, 2020|url-status=live}} Algorithms are used as specifications for performing [[calculation]]s and [[data processing]]. More advanced algorithms can use [[Conditional (computer programming)|conditional]]s to divert the code execution through various routes (referred to as [[automated decision-making]]) and deduce valid [[inference]]s (referred to as [[automated reasoning]]), achieving [[automation]] eventually. Using human characteristics as descriptors of machines in metaphorical ways was already practiced by [[Alan Turing]] with terms such as "memory", "search" and "stimulus".Blair, Ann, Duguid, Paul, Goeing, Anja-Silvia and Grafton, Anthony. Information: A Historical Companion, Princeton: Princeton University Press, 2021. p. 247 [7] => [8] => In contrast, a [[Heuristic (computer science)|heuristic]] is an approach to problem solving that may not be fully specified or may not guarantee correct or optimal results, especially in problem domains where there is no well-defined correct or optimal result.David A. Grossman, Ophir Frieder, ''Information Retrieval: Algorithms and Heuristics'', 2nd edition, 2004, {{isbn|1402030045}} For example, social media [[recommender system]]s rely on heuristics in such a way that, although widely characterized as "algorithms" in 21st century popular media, cannot deliver correct results due to the nature of the problem. [9] => [10] => As an [[effective method]], an algorithm can be expressed within a finite amount of space and time"Any classical mathematical algorithm, for example, can be described in a finite number of English words" (Rogers 1987:2). and in a well-defined [[formal language]]Well defined with respect to the agent that executes the algorithm: "There is a computing agent, usually human, which can react to the instructions and carry out the computations" (Rogers 1987:2). for calculating a [[Function (mathematics)|function]]."an algorithm is a procedure for computing a ''function'' (with respect to some chosen notation for integers) ... this limitation (to numerical functions) results in no loss of generality", (Rogers 1987:1). Starting from an initial state and initial input (perhaps [[Empty string|empty]]),"An algorithm has [[zero]] or more inputs, i.e., [[Quantity|quantities]] which are given to it initially before the algorithm begins" (Knuth 1973:5). the instructions describe a computation that, when [[Execution (computing)|execute]]d, proceeds through a finite"A procedure which has all the characteristics of an algorithm except that it possibly lacks finiteness may be called a 'computational method{{'"}} (Knuth 1973:5). number of well-defined successive states, eventually producing "output""An algorithm has one or more outputs, i.e. quantities which have a specified relation to the inputs" (Knuth 1973:5). and terminating at a final ending state. The transition from one state to the next is not necessarily [[deterministic]]; some algorithms, known as [[randomized algorithm]]s, incorporate random input.Whether or not a process with random interior processes (not including the input) is an algorithm is debatable. Rogers opines that: "a computation is carried out in a discrete stepwise fashion, without the use of continuous methods or analogue devices ... carried forward deterministically, without resort to random methods or devices, e.g., dice" (Rogers 1987:2). [11] => [12] => == Etymology == [13] => Around 825, Persian scientist and polymath [[Al-Khwarizmi|Muḥammad ibn Mūsā al-Khwārizmī]] wrote ''kitāb al-ḥisāb al-hindī'' ("Book of Indian computation") and ''kitab al-jam' wa'l-tafriq al-ḥisāb al-hindī'' ("Addition and subtraction in Indian arithmetic"). Both of these texts are lost in the original Arabic at this time. (However, his [[The Compendious Book on Calculation by Completion and Balancing|other book on algebra]] remains.) [14] => [15] => In the early 12th century, Latin translations of said al-Khwarizmi texts involving the [[Hindu–Arabic numeral system]] and [[arithmetic]] appeared: ''Liber Alghoarismi de practica arismetrice'' (attributed to [[John of Seville]]) and ''Liber Algorismi de numero Indorum'' (attributed to [[Adelard of Bath]]). Hereby, ''alghoarismi'' or ''algorismi'' is the [[Latinisation of names|Latinization]] of Al-Khwarizmi's name; the text starts with the phrase ''Dixit Algorismi'' ("Thus spoke Al-Khwarizmi"). [16] => [17] => Around 1230, the English word ''[[algorism]]'' is attested and then by [[Geoffrey Chaucer|Chaucer]] in 1391, English adopted the French term.{{Clarification needed|date=April 2024}} In the 15th century, under the influence of the Greek word ἀριθμός (''arithmos'', "number"; ''cf.'' "arithmetic"), the Latin word was altered to ''algorithmus''.{{Citation needed|date=April 2024}} [18] => [19] => == Definition == [20] => {{For|a detailed presentation of the various points of view on the definition of "algorithm"|Algorithm characterizations}} [21] => [22] => One informal definition is "a set of rules that precisely defines a sequence of operations",Stone 1973:4{{request quotation | reason = Stone (1972) suggests on page 4: "...any sequence of instructions that can be obeyed by a robot, is called an algorithm"|date=July 2020}} which would include all [[computer program]]s (including programs that do not perform numeric calculations), and (for example) any prescribed [[bureaucratic]] procedure [23] => {{cite book |last1=Simanowski |first1=Roberto |author-link1=Roberto Simanowski |url=https://books.google.com/books?id=RJV5DwAAQBAJ |title=The Death Algorithm and Other Digital Dilemmas |date=2018 |publisher=MIT Press |isbn=9780262536370 |series=Untimely Meditations |volume=14 |location=Cambridge, Massachusetts |page=147 |translator1-last=Chase |translator1-first=Jefferson |quote=[...] the next level of abstraction of central bureaucracy: globally operating algorithms. |access-date=27 May 2019 |archive-url=https://web.archive.org/web/20191222120705/https://books.google.com/books?id=RJV5DwAAQBAJ |archive-date=December 22, 2019 |url-status=live}} [24] => [25] => or [[Cookbook|cook-book]] [[recipe]]. [26] => {{cite book |last1=Dietrich |first1=Eric |url=https://books.google.com/books?id=-wt1aZrGXLYC |title=The MIT Encyclopedia of the Cognitive Sciences |publisher=MIT Press |year=1999 |isbn=9780262731447 |editor1-last=Wilson |editor1-first=Robert Andrew |series=MIT Cognet library |location=Cambridge, Massachusetts |publication-date=2001 |page=11 |chapter=Algorithm |quote=An algorithm is a recipe, method, or technique for doing something. |access-date=22 July 2020 |editor2-last=Keil |editor2-first=Frank C.}} [27] => In general, a program is an algorithm only if it stops eventuallyStone requires that "it must terminate in a finite number of steps" (Stone 1973:7–8).—even though [[infinite loop#Intentional looping|infinite loop]]s may sometimes prove desirable. {{Harvtxt|Boolos|Jeffrey|1974, 1999|ref=CITEREFBoolosJeffrey1999}} define an algorithm to be a set of instructions for determining an output, given explicitly, in a form that can be followed by either a computing machine, or a human who could only carry out specific elementary operations on symbols''.''Boolos and Jeffrey 1974,1999:19 [28] => [29] => The concept of ''algorithm'' is also used to define the notion of [[decidability (logic)|decidability]]—a notion that is central for explaining how [[formal system]]s come into being starting from a small set of [[axiom]]s and rules. In [[logic]], the time that an algorithm requires to complete cannot be measured, as it is not apparently related to the customary physical dimension. From such uncertainties, that characterize ongoing work, stems the unavailability of a definition of ''algorithm'' that suits both concrete (in some sense) and abstract usage of the term. [30] => [31] => Most algorithms are intended to be [[Implementation|implement]]ed as [[computer program]]s. However, algorithms are also implemented by other means, such as in a [[biological neural network]] (for example, the [[human brain]] implementing [[arithmetic]] or an insect looking for food), in an [[electrical circuit]], or in a mechanical device. [32] => [33] => == History == [34] => {{Missing information|1=section|2=20th and 21st century development of computer algorithms|date=October 2023}} [35] => [36] => === Ancient algorithms === [37] => Since antiquity, step-by-step procedures for solving mathematical problems have been attested. This includes [[Babylonian mathematics]] (around 2500 BC), [[Egyptian mathematics]] (around 1550 BC), [[Indian mathematics]] (around 800 BC and later; e.g. [[Shulba Sutras]], [[Kerala school of astronomy and mathematics|Kerala School]], and [[Brāhmasphuṭasiddhānta]]),{{cite book |last1=Sriram |first1=M. S. |editor1-last=Emch |editor1-first=Gerard G. |editor2-last=Sridharan |editor2-first=R. |editor3-last=Srinivas |editor3-first=M. D. |title=Contributions to the History of Indian Mathematics |date=2005 |publisher=Springer |isbn=978-93-86279-25-5 |page=153 |chapter-url=https://books.google.com/books?id=qfJdDwAAQBAJ&pg=PA153 |language=en |chapter=Algorithms in Indian Mathematics}}Hayashi, T. (2023, January 1). [https://www.britannica.com/biography/Brahmagupta Brahmagupta]. Encyclopedia Britannica. [https://www.jstor.org/stable/3027363 The Ifa Oracle] (around 500 BC), [[Greek mathematics]] (around 240 BC, e.g. [[sieve of Eratosthenes]] and [[Euclidean algorithm]]),{{cite book|last=Cooke|first=Roger L.|title=The History of Mathematics: A Brief Course|date=2005|publisher=John Wiley & Sons|isbn=978-1-118-46029-0}} and [[Arabic mathematics]] (9th century, e.g. [[cryptographic]] algorithms for [[code-breaking]] based on [[frequency analysis]]).{{cite book |last1=Dooley |first1=John F. |title=A Brief History of Cryptology and Cryptographic Algorithms |date=2013 |publisher=Springer Science & Business Media |isbn=9783319016283 |pages=12–3}} The first [[cryptographic]] algorithm for deciphering encrypted code was developed by [[Al-Kindi]], a 9th-century [[Mathematics in medieval Islam|Arab mathematician]], in ''A Manuscript On Deciphering Cryptographic Messages''. He gave the first description of [[cryptanalysis]] by [[frequency analysis]], the earliest [[codebreaking]] algorithm. [38] => [39] => ==== Ancient Near East ==== [40] => The earliest evidence of algorithms is found in the [[Babylonian mathematics]] of ancient [[Mesopotamia]] (modern Iraq). A [[Sumer]]ian clay tablet found in [[Shuruppak]] near [[Baghdad]] and dated to {{Circa|2500 BC}} described the earliest [[division algorithm]].{{cite book |last1=Chabert |first1=Jean-Luc |title=A History of Algorithms: From the Pebble to the Microchip |date=2012 |publisher=Springer Science & Business Media |isbn=9783642181924 |pages=7–8}} During the [[First Babylonian dynasty|Hammurabi dynasty]] {{Circa|1800|1600 BC}}, [[Babylonia]]n clay tablets described algorithms for computing [[formula]]s.{{cite journal |last1=Knuth |first1=Donald E. |title=Ancient Babylonian Algorithms |journal=Commun. ACM |date=1972 |volume=15 |issue=7 |pages=671–677 |doi=10.1145/361454.361514 |s2cid=7829945 |url=http://steiner.math.nthu.edu.tw/disk5/js/computer/1.pdf |archive-url=https://web.archive.org/web/20121224100137/http://steiner.math.nthu.edu.tw/disk5/js/computer/1.pdf |url-status=dead |archive-date=2012-12-24 |issn=0001-0782}} Algorithms were also used in [[Babylonian astronomy]]. Babylonian clay tablets describe and employ algorithmic procedures to compute the time and place of significant astronomical events.{{cite book | last = Aaboe | first = Asger | author-link = Asger Aaboe | date = 2001 | title = Episodes from the Early History of Astronomy | publisher = Springer | place = New York | pages = 40–62 | isbn = 978-0-387-95136-2 }} [41] => [42] => Algorithms for arithmetic are also found in ancient [[Egyptian mathematics]], dating back to the [[Rhind Mathematical Papyrus]] {{Circa|1550 BC}}. Algorithms were later used in ancient [[Hellenistic mathematics]]. Two examples are the [[Sieve of Eratosthenes]], which was described in the ''[[Introduction to Arithmetic]]'' by [[Nicomachus]],{{cite web|url=http://www.math.wichita.edu/history/men/eratosthenes.html|title=Eratosthenes|publisher=Wichita State University: Department of Mathematics and Statistics|first=Courtney|last=Ast|access-date=February 27, 2015|archive-url=https://web.archive.org/web/20150227150653/http://www.math.wichita.edu/history/men/eratosthenes.html|archive-date=February 27, 2015|url-status=live}}{{rp|Ch 9.2}} and the [[Euclidean algorithm]], which was first described in ''[[Euclid's Elements]]'' ({{circa|300 BC}}).{{rp|Ch 9.1}} [43] => [44] => === Computers === [45] => [46] => ==== Weight-driven clocks ==== [47] => Bolter credits the invention of the weight-driven [[clock]] as "The key invention [of Europe in the Middle Ages]", in particular, the [[verge escapement]]Bolter 1984:24 that provides us with the tick and tock of a mechanical clock. "The accurate automatic machine"Bolter 1984:26 led immediately to "mechanical [[automata theory|automata]]" beginning in the 13th century and finally to "computational machines"—the [[difference engine]] and [[analytical engines]] of [[Charles Babbage]] and Countess [[Ada Lovelace]], mid-19th century.Bolter 1984:33–34, 204–206. Lovelace is credited with the first creation of an algorithm intended for processing on a computer—Babbage's analytical engine, the first device considered a real [[Turing-complete]] computer instead of just a [[calculator]]—and is sometimes called "history's first programmer" as a result, though a full implementation of Babbage's second device would not be realized until decades after her lifetime. [48] => [49] => ==== Electromechanical relay ==== [50] => Bell and Newell (1971) indicate that the [[Jacquard loom]] (1801), precursor to [[Hollerith card]]s (punch cards, 1887), and "telephone switching technologies" were the roots of a tree leading to the development of the first computers.Bell and Newell diagram 1971:39, cf. Davis 2000 By the mid-19th century the [[telegraph]], the precursor of the telephone, was in use throughout the world, its discrete and distinguishable encoding of letters as "dots and dashes" a common sound. By the late 19th century the [[ticker tape]] ({{circa|1870s}}) was in use, as was the use of Hollerith cards in the 1890 U.S. census. Then came the [[teleprinter]] ({{circa|1910}}) with its punched-paper use of [[Baudot code]] on tape. [51] => [52] => Telephone-switching networks of electromechanical [[relays]] (invented 1835) was behind the work of [[George Stibitz]] (1937), the inventor of the digital adding device. As he worked in Bell Laboratories, he observed the "burdensome' use of mechanical calculators with gears. "He went home one evening in 1937 intending to test his idea... When the tinkering was over, Stibitz had constructed a binary adding device".* Melina Hill, Valley News Correspondent, ''A Tinkerer Gets a Place in History'', Valley News West Lebanon NH, Thursday, March 31, 1983, p. 13. The mathematician [[Martin Davis (mathematician)|Martin Davi]]s supported the particular importance of the electromechanical relay.Davis 2000:14 [53] => [54] => === Formalization === [55] => [[File:Diagram for the computation of Bernoulli numbers.jpg|thumb|[[Ada Lovelace]]'s diagram from "[[Note G]]", the first published computer algorithm]] [56] => [57] => In 1928, a partial formalization of the modern concept of algorithms began with attempts to solve the ''[[Entscheidungsproblem]] ''(decision problem) posed by [[David Hilbert]]. Later formalizations were framed as attempts to define "[[effective calculability]]"Kleene 1943 in Davis 1965:274 or "effective method".Rosser 1939 in Davis 1965:225 Those formalizations included the [[Kurt Gödel|Gödel]]–[[Jacques Herbrand|Herbrand]]–[[Stephen Cole Kleene|Kleene]] [[Recursion (computer science)|recursive function]]s of 1930, 1934 and 1935, [[Alonzo Church]]'s [[lambda calculus]] of 1936, [[Emil Post]]'s [[Formulation 1]] of 1936, and [[Alan Turing]]'s [[Turing machines]] of 1936–37 and 1939. [58] => [59] => ==Representations== [60] => Algorithms can be expressed in many kinds of notation, including [[natural languages]], [[pseudocode]], [[flowchart]]s, [[DRAKON|drakon-chart]]s, [[programming languages]] or [[control table]]s (processed by [[Interpreter (computing)|interpreter]]s). Natural language expressions of algorithms tend to be verbose and ambiguous and are rarely used for complex or technical algorithms. Pseudocode, flowcharts, drakon-charts and control tables are structured ways to express algorithms that avoid many of the ambiguities common in statements based on natural language. Programming languages are primarily intended for expressing algorithms in a form that can be executed by a computer, but they are also often used as a way to define or document algorithms. [61] => [62] => === Turing machines === [63] => There is a wide variety of representations possible and one can express a given [[Turing machine]] program as a sequence of machine tables (see [[finite-state machine]], [[state-transition table]] and [[control table]] for more), as flowcharts and drakon-charts (see [[state diagram]] for more), or as a form of rudimentary [[machine code]] or [[assembly code]] called "sets of quadruples" (see [[Turing machine]] for more). Representations of algorithms can also be classified into three accepted levels of Turing machine description: high level description, implementation description, and formal description.Sipser 2006:157 A high level description describes qualities of the algorithm itself, ignoring how it is implemented on the turing machine. An implementation description describes the general manner in which the turing machine moves its head and stores data in order to carry out the algorithm, but doesn't give exact states. In the most detail, a formal description gives the exact state table and list of transitions of the turing machine. [64] => [65] => === Flowchart representation === [66] => The graphical aid called a [[flowchart]] offers a way to describe and document an algorithm (and a computer program corresponding to it). Like the program flow of a Minsky machine, a flowchart always starts at the top of a page and proceeds down. Its primary symbols are only four: the directed arrow showing program flow, the rectangle (SEQUENCE, GOTO), the diamond (IF-THEN-ELSE), and the dot (OR-tie). The Böhm–Jacopini canonical structures are made of these primitive shapes. Sub-structures can "nest" in rectangles, but only if a single exit occurs from the superstructure. The symbols and their use to build the canonical structures are shown in the diagram.''cf Tausworthe 1977'' [67] => [68] => == Algorithmic analysis == [69] => {{Main|Analysis of algorithms}} [70] => [71] => It is frequently important to know how much of a particular resource (such as time or storage) is theoretically required for a given algorithm. Methods have been developed for the analysis of algorithms to obtain such quantitative answers (estimates); for example, an algorithm which adds up the elements of a list of ''n'' numbers would have a time requirement of {{tmath|O(n)}}, using [[big O notation]]. At all times the algorithm only needs to remember two values: the sum of all the elements so far, and its current position in the input list. Therefore, it is said to have a space requirement of {{tmath|O(1)}}, if the space required to store the input numbers is not counted, or {{tmath|O(n)}} if it is counted. [72] => [73] => Different algorithms may complete the same task with a different set of instructions in less or more time, space, or '[[algorithmic efficiency|effort]]' than others. For example, a [[binary search]] algorithm (with cost {{tmath|O(\log n)}}) outperforms a sequential search (cost {{tmath|O(n)}} ) when used for [[lookup table|table lookup]]s on sorted lists or arrays. [74] => [75] => ===Formal versus empirical=== [76] => {{Main|Empirical algorithmics|Profiling (computer programming)|Program optimization}} [77] => [78] => The [[analysis of algorithms|analysis, and study of algorithm]]s is a discipline of [[computer science]], and is often practiced abstractly without the use of a specific [[programming language]] or implementation. In this sense, algorithm analysis resembles other mathematical disciplines in that it focuses on the underlying properties of the algorithm and not on the specifics of any particular implementation. Usually [[pseudocode]] is used for analysis as it is the simplest and most general representation. However, ultimately, most algorithms are usually implemented on particular hardware/software platforms and their [[algorithmic efficiency]] is eventually put to the test using real code. For the solution of a "one off" problem, the efficiency of a particular algorithm may not have significant consequences (unless n is extremely large) but for algorithms designed for fast interactive, commercial or long life scientific usage it may be critical. Scaling from small n to large n frequently exposes inefficient algorithms that are otherwise benign. [79] => [80] => Empirical testing is useful because it may uncover unexpected interactions that affect performance. [[Benchmark (computing)|Benchmark]]s may be used to compare before/after potential improvements to an algorithm after program optimization. [81] => Empirical tests cannot replace formal analysis, though, and are not trivial to perform in a fair manner.{{cite journal|last1=Kriegel|first1=Hans-Peter|author-link=Hans-Peter Kriegel|last2=Schubert|first2=Erich|last3=Zimek|first3=Arthur|author-link3=Arthur Zimek|title=The (black) art of run-time evaluation: Are we comparing algorithms or implementations?|journal=Knowledge and Information Systems|volume=52|issue=2|year=2016|pages=341–378|issn=0219-1377|doi=10.1007/s10115-016-1004-2|s2cid=40772241}} [82] => [83] => === Execution efficiency === [84] => {{Main|Algorithmic efficiency}} [85] => [86] => To illustrate the potential improvements possible even in well-established algorithms, a recent significant innovation, relating to [[Fast Fourier transform|FFT]] algorithms (used heavily in the field of image processing), can decrease processing time up to 1,000 times for applications like medical imaging.{{cite web| title=Better Math Makes Faster Data Networks| author=Gillian Conahan| date=January 2013| url=http://discovermagazine.com/2013/jan-feb/34-better-math-makes-faster-data-networks| publisher=discovermagazine.com| access-date=May 13, 2014| archive-url=https://web.archive.org/web/20140513212427/http://discovermagazine.com/2013/jan-feb/34-better-math-makes-faster-data-networks| archive-date=May 13, 2014| url-status=live}} In general, speed improvements depend on special properties of the problem, which are very common in practical applications.Haitham Hassanieh, [[Piotr Indyk]], Dina Katabi, and Eric Price, "[http://siam.omnibooksonline.com/2012SODA/data/papers/500.pdf ACM-SIAM Symposium On Discrete Algorithms (SODA)] {{webarchive|url=https://web.archive.org/web/20130704180806/http://siam.omnibooksonline.com/2012SODA/data/papers/500.pdf |date=July 4, 2013 }}, Kyoto, January 2012. See also the [http://groups.csail.mit.edu/netmit/sFFT/ sFFT Web Page] {{Webarchive|url=https://web.archive.org/web/20120221145740/http://groups.csail.mit.edu/netmit/sFFT/ |date=February 21, 2012 }}. Speedups of this magnitude enable computing devices that make extensive use of image processing (like digital cameras and medical equipment) to consume less power. [87] => [88] => == Design == [89] => {{See also|Algorithm#By design paradigm}} [90] => [91] => Algorithm design refers to a method or a mathematical process for problem-solving and engineering algorithms. The design of algorithms is part of many solution theories, such as [[divide-and-conquer algorithm|divide-and-conquer]] or [[dynamic programming]] within [[operation research]]. Techniques for designing and implementing algorithm designs are also called algorithm design patterns,{{cite book |last1=Goodrich |first1=Michael T. |author1-link=Michael T. Goodrich |url=http://ww3.algorithmdesign.net/ch00-front.html |title=Algorithm Design: Foundations, Analysis, and Internet Examples |last2=Tamassia |first2=Roberto |author2-link=Roberto Tamassia |publisher=John Wiley & Sons, Inc. |year=2002 |isbn=978-0-471-38365-9 |access-date=June 14, 2018 |archive-url=https://web.archive.org/web/20150428201622/http://ww3.algorithmdesign.net/ch00-front.html |archive-date=April 28, 2015 |url-status=live}} with examples including the template method pattern and the decorator pattern. One of the most important aspects of algorithm design is resource (run-time, memory usage) efficiency; the [[big O notation]] is used to describe e.g., an algorithm's run-time growth as the size of its input increases.{{Citation needed|date=April 2024}} [92] => [93] => === Structured programming === [94] => Per the [[Church–Turing thesis]], any algorithm can be computed by a model known to be [[Turing complete]]. In fact, it has been demonstrated that Turing completeness requires only four instruction types—conditional GOTO, unconditional GOTO, assignment, HALT. However, Kemeny and Kurtz observe that, while "undisciplined" use of unconditional GOTOs and conditional IF-THEN GOTOs can result in "[[spaghetti code]]", a programmer can write structured programs using only these instructions; on the other hand "it is also possible, and not too hard, to write badly structured programs in a structured language".[[John G. Kemeny]] and [[Thomas E. Kurtz]] 1985 ''Back to Basic: The History, Corruption, and Future of the Language'', Addison-Wesley Publishing Company, Inc. Reading, MA, {{ISBN|0-201-13433-0}}. Tausworthe augments the three [[Structured program theorem|Böhm-Jacopini canonical structures]]:Tausworthe 1977:101 SEQUENCE, IF-THEN-ELSE, and WHILE-DO, with two more: DO-WHILE and CASE.Tausworthe 1977:142 An additional benefit of a structured program is that it lends itself to [[proof of correctness|proofs of correctnes]]s using [[mathematical induction]].Knuth 1973 section 1.2.1, expanded by Tausworthe 1977 at pages 100ff and Chapter 9.1 [95] => [96] => == Classification == [97] => There are various ways to classify algorithms, each with its own merits. [98] => [99] => === By implementation === [100] => One way to classify algorithms is by implementation means. [101] => [102] => {| style="float:right; width:200pt;" [103] => |- [104] => | [105] => [106] => int gcd(int A, int B) { [107] => if (B == 0) [108] => return A; [109] => else if (A > B) [110] => return gcd(A-B,B); [111] => else [112] => return gcd(A,B-A); [113] => } [114] => [115] => |- [116] => | Recursive [[C (programming language)|C]] implementation of Euclid's algorithm from the [[#lead|above]] flowchart [117] => |} [118] => [119] => ; Recursion [120] => : A [[recursive algorithm]] is one that invokes (makes reference to) itself repeatedly until a certain condition (also known as termination condition) matches, which is a method common to [[functional programming]]. [[Iteration|Iterative]] algorithms use repetitive constructs like [[Program loops|loop]]s and sometimes additional data structures like [[Stack (data structure)|stack]]s to solve the given problems. Some problems are naturally suited for one implementation or the other. For example, [[towers of Hanoi]] is well understood using recursive implementation. Every recursive version has an equivalent (but possibly more or less complex) iterative version, and vice versa. [121] => ; Serial, parallel or distributed [122] => : Algorithms are usually discussed with the assumption that computers execute one instruction of an algorithm at a time. Those computers are sometimes called serial computers. An [[algorithm design]]ed for such an environment is called a serial algorithm, as opposed to [[parallel algorithm]]s or [[distributed algorithm]]s. Parallel algorithms are algorithms that take advantage of computer architectures where multiple processors can work on a problem at the same time. Distributed algorithms are algorithms that use multiple machines connected with a computer network. Parallel and distributed algorithms divide the problem into more symmetrical or asymmetrical subproblems and collect the results back together. For example, a CPU would be an example of a parallel algorithm. The resource consumption in such algorithms is not only processor cycles on each processor but also the communication overhead between the processors. Some sorting algorithms can be parallelized efficiently, but their communication overhead is expensive. Iterative algorithms are generally parallelizable, but some problems have no parallel algorithms and are called inherently serial problems. [123] => ; Deterministic or non-deterministic [124] => : [[Deterministic algorithm]]s solve the problem with exact decision at every step of the algorithm whereas [[non-deterministic algorithm]]s solve problems via guessing although typical guesses are made more accurate through the use of [[heuristics]]. [125] => ; Exact or approximate [126] => : While many algorithms reach an exact solution, [[approximation algorithm]]s seek an approximation that is closer to the true solution. The approximation can be reached by either using a deterministic or a random strategy. Such algorithms have practical value for many hard problems. One of the examples of an approximate algorithm is the [[Knapsack problem]], where there is a set of given items. Its goal is to pack the knapsack to get the maximum total value. Each item has some weight and some value. Total weight that can be carried is no more than some fixed number X. So, the solution must consider weights of items as well as their value.{{Cite book|url=https://www.springer.com/us/book/9783540402862|title=Knapsack Problems {{!}} Hans Kellerer {{!}} Springer|language=en|isbn=978-3-540-40286-2|publisher=Springer|year=2004|doi=10.1007/978-3-540-24777-7|access-date=September 19, 2017|archive-url=https://web.archive.org/web/20171018181055/https://www.springer.com/us/book/9783540402862|archive-date=October 18, 2017|url-status=live|last1=Kellerer|first1=Hans|last2=Pferschy|first2=Ulrich|last3=Pisinger|first3=David|s2cid=28836720 }} [127] => ; Quantum algorithm [128] => : [[Quantum algorithm]]s run on a realistic model of [[quantum computation]]. The term is usually used for those algorithms which seem inherently quantum, or use some essential feature of [[Quantum computing]] such as [[quantum superposition]] or [[quantum entanglement]]. [129] => [130] => === By design paradigm === [131] => Another way of classifying algorithms is by their design methodology or [[algorithmic paradigm|paradigm]]. There is a certain number of paradigms, each different from the other. Furthermore, each of these categories includes many different types of algorithms. Some common paradigms are: [132] => [133] => ; [[Brute-force search|Brute-force]] or exhaustive search [134] => : Brute force is a method of problem-solving that involves systematically trying every possible option until the optimal solution is found. This approach can be very time consuming, as it requires going through every possible combination of variables. However, it is often used when other methods are not available or too complex. Brute force can be used to solve a variety of problems, including finding the shortest path between two points and cracking passwords. [135] => ; Divide and conquer [136] => : A [[divide-and-conquer algorithm]] repeatedly reduces an instance of a problem to one or more smaller instances of the same problem (usually [[recursion|recursively]]) until the instances are small enough to solve easily. One such example of divide and conquer is [[mergesort|merge sorting]]. Sorting can be done on each segment of data after dividing data into segments and sorting of entire data can be obtained in the conquer phase by merging the segments. A simpler variant of divide and conquer is called a ''decrease-and-conquer algorithm'', which solves an identical subproblem and uses the solution of this subproblem to solve the bigger problem. Divide and conquer divides the problem into multiple subproblems and so the conquer stage is more complex than decrease and conquer algorithms. An example of a decrease and conquer algorithm is the [[binary search algorithm]]. [137] => ; Search and enumeration [138] => : Many problems (such as playing [[Chess|ches]]s) can be modeled as problems on [[graph theory|graph]]s. A [[graph exploration algorithm]] specifies rules for moving around a graph and is useful for such problems. This category also includes [[search algorithm]]s, [[branch and bound]] enumeration and [[backtracking]]. [139] => ;[[Randomized algorithm]] [140] => : Such algorithms make some choices randomly (or pseudo-randomly). They can be very useful in finding approximate solutions for problems where finding exact solutions can be impractical (see heuristic method below). For some of these problems, it is known that the fastest approximations must involve some [[randomness]].For instance, the [[volume]] of a [[convex polytope]] (described using a membership oracle) can be approximated to high accuracy by a randomized polynomial time algorithm, but not by a deterministic one: see {{cite journal [141] => | last1 = Dyer | first1 = Martin [142] => | last2 = Frieze | first2 = Alan [143] => | last3 = Kannan | first3 = Ravi [144] => | date = January 1991 [145] => | doi = 10.1145/102782.102783 [146] => | issue = 1 [147] => | journal = J. ACM [148] => | pages = 1–17 [149] => | title = A Random Polynomial-time Algorithm for Approximating the Volume of Convex Bodies [150] => | volume = 38| citeseerx = 10.1.1.145.4600| s2cid = 13268711 [151] => }} Whether randomized algorithms with [[P (complexity)|polynomial time complexity]] can be the fastest algorithms for some problems is an open question known as the [[P versus NP problem]]. There are two large classes of such algorithms: [152] => # [[Monte Carlo algorithm]]s return a correct answer with high-probability. E.g. [[RP (complexity)|RP]] is the subclass of these that run in [[polynomial time]]. [153] => # [[Las Vegas algorithm]]s always return the correct answer, but their running time is only probabilistically bound, e.g. [[Zero-error Probabilistic Polynomial time|ZPP]]. [154] => ; [[Reduction (complexity)|Reduction of complexity]] [155] => : This technique involves solving a difficult problem by transforming it into a better-known problem for which we have (hopefully) [[asymptotically optimal]] algorithms. The goal is to find a reducing algorithm whose [[Computational complexity theory|complexity]] is not dominated by the resulting reduced algorithm's. For example, one [[selection algorithm]] for finding the median in an unsorted list involves first sorting the list (the expensive portion) and then pulling out the middle element in the sorted list (the cheap portion). This technique is also known as ''[[Transform and conquer algorithm|transform and conquer]]''. [156] => ; [[Back tracking]] [157] => : In this approach, multiple solutions are built incrementally and abandoned when it is determined that they cannot lead to a valid full solution. [158] => [159] => === Optimization problems === [160] => For [[optimization problem]]s there is a more specific classification of algorithms; an algorithm for such problems may fall into one or more of the general categories described above as well as into one of the following: [161] => [162] => ; [[Linear programming]] [163] => : When searching for optimal solutions to a linear function bound to linear equality and inequality constraints, the constraints of the problem can be used directly in producing the optimal solutions. There are algorithms that can solve any problem in this category, such as the popular [[simplex algorithm]]. [164] => [[George B. Dantzig]] and Mukund N. Thapa. 2003. ''Linear Programming 2: Theory and Extensions''. Springer-Verlag. Problems that can be solved with linear programming include the [[maximum flow problem]] for directed graphs. If a problem additionally requires that one or more of the unknowns must be an [[integer]] then it is classified in [[integer programming]]. A linear programming algorithm can solve such a problem if it can be proved that all restrictions for integer values are superficial, i.e., the solutions satisfy these restrictions anyway. In the general case, a specialized algorithm or an algorithm that finds approximate solutions is used, depending on the difficulty of the problem. [165] => ; [[Dynamic programming]] [166] => : When a problem shows [[optimal substructures]]—meaning the optimal solution to a problem can be constructed from optimal solutions to subproblems—and [[overlapping subproblem]]s, meaning the same subproblems are used to solve many different problem instances, a quicker approach called ''dynamic programming'' avoids recomputing solutions that have already been computed. For example, [[Floyd–Warshall algorithm]], the shortest path to a goal from a vertex in a weighted [[graph (discrete mathematics)|graph]] can be found by using the shortest path to the goal from all adjacent vertices. Dynamic programming and [[memoization]] go together. The main difference between dynamic programming and divide and conquer is that subproblems are more or less independent in divide and conquer, whereas subproblems overlap in dynamic programming. The difference between dynamic programming and straightforward recursion is in caching or memoization of recursive calls. When subproblems are independent and there is no repetition, memoization does not help; hence dynamic programming is not a solution for all complex problems. By using memoization or maintaining a [[Mathematical table|table]] of subproblems already solved, dynamic programming reduces the exponential nature of many problems to polynomial complexity. [167] => ; The greedy method [168] => : A [[greedy algorithm]] is similar to a dynamic programming algorithm in that it works by examining substructures, in this case not of the problem but of a given solution. Such algorithms start with some solution, which may be given or have been constructed in some way, and improve it by making small modifications. For some problems they can find the optimal solution while for others they stop at [[local optimum|local optima]], that is, at solutions that cannot be improved by the algorithm but are not optimum. The most popular use of greedy algorithms is for finding the minimal spanning tree where finding the optimal solution is possible with this method. [[Huffman coding|Huffman Tree]], [[kruskal's algorithm|Kruskal]], [[Prim's algorithm|Prim]], [[Sollin's algorithm|Sollin]] are greedy algorithms that can solve this optimization problem. [169] => ;The heuristic method [170] => :In [[optimization problem]]s, [[heuristic algorithm]]s can be used to find a solution close to the optimal solution in cases where finding the optimal solution is impractical. These algorithms work by getting closer and closer to the optimal solution as they progress. In principle, if run for an infinite amount of time, they will find the optimal solution. Their merit is that they can find a solution very close to the optimal solution in a relatively short time. Such algorithms include [[local search (optimization)|local search]], [[tabu search]], [[simulated annealing]], and [[genetic algorithm]]s. Some of them, like simulated annealing, are non-deterministic algorithms while others, like tabu search, are deterministic. When a bound on the error of the non-optimal solution is known, the algorithm is further categorized as an [[approximation algorithm]]. [171] => [172] => == Legal status == [173] => {{see also|Software patent}} [174] => [175] => Algorithms, by themselves, are not usually patentable. In the United States, a claim consisting solely of simple manipulations of abstract concepts, numbers, or signals does not constitute "processes" (USPTO 2006), so algorithms are not patentable (as in [[Gottschalk v. Benson]]). However practical applications of algorithms are sometimes patentable. For example, in [[Diamond v. Diehr]], the application of a simple [[feedback]] algorithm to aid in the curing of [[synthetic rubber]] was deemed patentable. The [[Software patent debate|patenting of software]] is controversial,{{Cite news |date=2013-05-16 |title=The Experts: Does the Patent System Encourage Innovation? |url=https://www.wsj.com/articles/SB10001424127887323582904578487200821421958 |access-date=2017-03-29 |work=[[The Wall Street Journal]] |issn=0099-9660}} and there are criticized patents involving algorithms, especially [[data compression]] algorithms, such as [[Unisys]]'s [[Graphics Interchange Format#Unisys and LZW patent enforcement|LZW patent]]. Additionally, some cryptographic algorithms have export restrictions (see [[export of cryptography]]). [176] => [177] => == Examples == [178] => {{Further|List of algorithms}} [179] => [180] => One of the simplest algorithms is to find the largest number in a list of numbers of random order. Finding the solution requires looking at every number in the list. From this follows a simple algorithm, which can be stated in a high-level description in English prose, as: [181] => [182] => ''High-level description:'' [183] => # If there are no numbers in the set, then there is no highest number. [184] => # Assume the first number in the set is the largest number in the set. [185] => # For each remaining number in the set: if this number is larger than the current largest number, consider this number to be the largest number in the set. [186] => # When there are no numbers left in the set to iterate over, consider the current largest number to be the largest number of the set. [187] => [188] => ''(Quasi-)formal description:'' [189] => Written in prose but much closer to the high-level language of a computer program, the following is the more formal coding of the algorithm in [[pseudocode]] or [[pidgin code]]: [190] => [191] => {{algorithm-begin|name=LargestNumber}} [192] => Input: A list of numbers ''L''. [193] => Output: The largest number in the list ''L''. [194] => [195] => '''if''' ''L.size'' = 0 '''return''' null [196] => ''largest'' ← ''L''[0] [197] => '''for each''' ''item'' '''in''' ''L'', '''do''' [198] => '''if''' ''item'' > ''largest'', '''then''' [199] => ''largest'' ← ''item'' [200] => '''return''' ''largest'' [201] => {{algorithm-end}} [202] => [203] => == See also == [204] => {{Portal|Mathematics|Computer programming}} [205] => {{div col|colwidth=22em}} [206] => * [[Abstract machine]] [207] => * [[ALGOL]] [208] => * [[Algorithm engineering]] [209] => * [[Algorithm characterizations]] [210] => * [[Algorithmic bias]] [211] => * [[Algorithmic composition]] [212] => * [[Algorithmic entities]] [213] => * [[Algorithmic synthesis]] [214] => * [[Algorithmic technique]] [215] => * [[Algorithmic topology]] [216] => * [[Garbage in, garbage out]] [217] => * ''[[Introduction to Algorithms]]'' (textbook) [218] => * [[Government by algorithm]] [219] => * [[List of algorithms]] [220] => * [[List of algorithm general topics]] [221] => * [[Regulation of algorithms]] [222] => * [[Theory of computation]] [223] => ** [[Computability theory]] [224] => ** [[Computational complexity theory]] [225] => * [[Computational mathematics]] [226] => {{div col end}} [227] => [228] => == Notes == [229] => {{Reflist}} [230] => [231] => == Bibliography == [232] => {{refbegin|30em}} [233] => * {{cite journal | last1 = Axt | first1 = P | year = 1959 | title = On a Subrecursive Hierarchy and Primitive Recursive Degrees | journal = Transactions of the American Mathematical Society | volume = 92 | issue = 1| pages = 85–105 | doi=10.2307/1993169| jstor = 1993169 | doi-access = free}} [234] => * Bell, C. Gordon and Newell, Allen (1971), ''Computer Structures: Readings and Examples'', McGraw–Hill Book Company, New York. {{ISBN|0-07-004357-4}}. [235] => * {{Cite journal|author1-link=Andreas Blass|first1=Andreas|last1=Blass|author2-link=Yuri Gurevich|first2=Yuri|last2=Gurevich|year=2003|url=http://research.microsoft.com/~gurevich/Opera/164.pdf |archive-url=https://ghostarchive.org/archive/20221009/http://research.microsoft.com/~gurevich/Opera/164.pdf |archive-date=2022-10-09 |url-status=live|title=Algorithms: A Quest for Absolute Definitions|journal= Bulletin of European Association for Theoretical Computer Science|volume= 81}} Includes a bibliography of 56 references. [236] => * {{cite book| last = Bolter| first = David J.| title = Turing's Man: Western Culture in the Computer Age| edition = 1984| year = 1984| publisher = The University of North Carolina Press|location= Chapel Hill, NC| isbn = 978-0-8078-1564-9 }}, {{ISBN|0-8078-4108-0}} [237] => * {{cite book| last1 = Boolos| first1 = George| last2 = Jeffrey| first2 = Richard| title = Computability and Logic| url = https://archive.org/details/computabilitylog0000bool_r8y9| url-access = registration| edition = 4th| orig-year = 1974| year = 1999| publisher = Cambridge University Press, London| isbn = 978-0-521-20402-6| author1-link = George Boolos| author2-link = Richard Jeffrey }}: cf. Chapter 3 ''Turing machines'' where they discuss "certain enumerable sets not effectively (mechanically) enumerable". [238] => * {{cite book| last = Burgin| first = Mark| title = Super-Recursive Algorithms| year = 2004| publisher = Springer| isbn = 978-0-387-95569-8 }} [239] => * Campagnolo, M.L., [[Cris Moore|Moore, C.]], and Costa, J.F. (2000) An analog characterization of the subrecursive functions. In ''Proc. of the 4th Conference on Real Numbers and Computers'', Odense University, pp. 91–109 [240] => * {{Cite journal|last=Church|first=Alonzo|author-link=Alonzo Church|title=An Unsolvable Problem of Elementary Number Theory|journal=The American Journal of Mathematics|volume=58|pages= 345–363|year=1936|doi=10.2307/2371045|issue=2|jstor=2371045}} Reprinted in ''The Undecidable'', p. 89ff. The first expression of "Church's Thesis". See in particular page 100 (''The Undecidable'') where he defines the notion of "effective calculability" in terms of "an algorithm", and he uses the word "terminates", etc. [241] => * {{Cite journal|last=Church|first=Alonzo|author-link=Alonzo Church|title=A Note on the Entscheidungsproblem|journal=The Journal of Symbolic Logic|volume=1|year=1936|pages=40–41|doi=10.2307/2269326|issue=1|jstor=2269326|s2cid=42323521 }} {{cite journal|last=Church|first=Alonzo|title=Correction to a Note on the Entscheidungsproblem|journal=The Journal of Symbolic Logic|volume=1|year=1936|pages=101–102|doi=10.2307/2269030|issue=3|jstor=2269030|s2cid=5557237 }} Reprinted in ''The Undecidable'', p. 110ff. Church shows that the Entscheidungsproblem is unsolvable in about 3 pages of text and 3 pages of footnotes. [242] => * {{cite book| last = Daffa'| first = Ali Abdullah al-| title = The Muslim contribution to mathematics| year = 1977| publisher = Croom Helm| location = London| isbn = 978-0-85664-464-1 }} [243] => * {{cite book| last = Davis| first = Martin| author-link = Martin Davis (mathematician)| title = The Undecidable: Basic Papers On Undecidable Propositions, Unsolvable Problems and Computable Functions| url = https://archive.org/details/undecidablebasic0000davi| url-access = registration| year = 1965| publisher = Raven Press| location = New York| isbn = 978-0-486-43228-1 }} Davis gives commentary before each article. Papers of [[Gödel]], [[Alonzo Church]], [[Alan Turing|Turing]], [[J. Barkley Rosser|Rosser]], [[Kleene]], and [[Emil Post]] are included; those cited in the article are listed here by author's name. [244] => * {{cite book| last = Davis| first = Martin| author-link = Martin Davis (mathematician)| title = Engines of Logic: Mathematicians and the Origin of the Computer| year = 2000| publisher = W.W. Nortion| location = New York| isbn = 978-0-393-32229-3 }} Davis offers concise biographies of [[Gottfried Leibniz|Leibniz]], [[George Boole|Boole]], [[Gottlob Frege|Frege]], [[Georg Cantor|Cantor]], [[David Hilbert|Hilbert]], Gödel and Turing with [[John von Neumann|von Neumann]] as the show-stealing villain. Very brief bios of [[Joseph-Marie Jacquard]], [[Babbage]], [[Ada Lovelace]], [[Claude Shannon]], [[Howard Aiken]], etc. [245] => * {{DADS|algorithm|algorithm}} [246] => * {{cite journal|title= Evolution and moral diversity |author=Dean, Tim |journal=Baltic International Yearbook of Cognition, Logic and Communication|year=2012|volume=7|doi=10.4148/biyclc.v7i0.1775 |doi-access=free}} [247] => * {{cite book| last = Dennett| first = Daniel| author-link = Daniel Dennett| title = Darwin's Dangerous Idea| journal = Complexity| volume = 2| issue = 1| pages = [https://archive.org/details/darwinsdangerous0000denn/page/32 32]–36| year = 1995| publisher = Touchstone/Simon & Schuster| location = New York| isbn = 978-0-684-80290-9| bibcode = 1996Cmplx...2a..32M| doi = 10.1002/(SICI)1099-0526(199609/10)2:1<32::AID-CPLX8>3.0.CO;2-H| url = https://archive.org/details/darwinsdangerous0000denn| url-access = registration}} [248] => * {{cite book| last = Dilson| first = Jesse| title = The Abacus| edition = (1968, 1994)| year = 2007| publisher = St. Martin's Press, NY| isbn = 978-0-312-10409-2| url = https://archive.org/details/abacusworldsfirs0000dils}}, {{ISBN|0-312-10409-X}} [249] => * [[Yuri Gurevich]], [http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.146.3017&rep=rep1&type=pdf ''Sequential Abstract State Machines Capture Sequential Algorithms''], ACM Transactions on Computational Logic, Vol 1, no 1 (July 2000), pp. 77–111. Includes bibliography of 33 sources. [250] => * {{cite book| last = van Heijenoort| first = Jean| author-link = Jean van Heijenoort| title = From Frege to Gödel, A Source Book in Mathematical Logic, 1879–1931| edition = (1967)| year = 2001| publisher = Harvard University Press, Cambridge| isbn = 978-0-674-32449-7 }}, 3rd edition 1976[?], {{ISBN|0-674-32449-8}} (pbk.) [251] => * {{cite book| last = Hodges| first = Andrew| author-link = Andrew Hodges| title = Alan Turing: The Enigma| journal = Physics Today| volume = 37| issue = 11| pages = 107–108| year = 1983| publisher = [[Simon and Schuster]]| location = New York| isbn = 978-0-671-49207-6| title-link = Alan Turing: The Enigma| bibcode = 1984PhT....37k.107H| doi = 10.1063/1.2915935}}, {{ISBN|0-671-49207-1}}. Cf. Chapter "The Spirit of Truth" for a history leading to, and a discussion of, his proof. [252] => * {{Cite journal|last=Kleene|first=Stephen C.|author-link=Stephen Kleene|title=General Recursive Functions of Natural Numbers|journal=Mathematische Annalen|volume=112|pages=727–742|url=http://gdz.sub.uni-goettingen.de/index.php?id=11&PPN=GDZPPN002278499&L=1|year=1936|doi=10.1007/BF01565439|issue=5|s2cid=120517999|access-date=September 30, 2013|archive-url=https://web.archive.org/web/20140903092121/http://gdz.sub.uni-goettingen.de/index.php?id=11&PPN=GDZPPN002278499&L=1|archive-date=September 3, 2014|url-status=dead}} Presented to the American Mathematical Society, September 1935. Reprinted in ''The Undecidable'', p. 237ff. Kleene's definition of "general recursion" (known now as mu-recursion) was used by Church in his 1935 paper ''An Unsolvable Problem of Elementary Number Theory'' that proved the "decision problem" to be "undecidable" (i.e., a negative result). [253] => * {{Cite journal|last=Kleene|first=Stephen C.|author-link=Stephen Kleene |title= Recursive Predicates and Quantifiers|journal= Transactions of the American Mathematical Society|volume=53|pages=41–73|year=1943 |doi= 10.2307/1990131|issue=1|jstor=1990131|doi-access=free}} Reprinted in ''The Undecidable'', p. 255ff. Kleene refined his definition of "general recursion" and proceeded in his chapter "12. Algorithmic theories" to posit "Thesis I" (p. 274); he would later repeat this thesis (in Kleene 1952:300) and name it "Church's Thesis"(Kleene 1952:317) (i.e., the [[Church thesis]]). [254] => * {{cite book| last = Kleene| first = Stephen C.| author-link = Kleene| title = Introduction to Metamathematics| edition = Tenth|year= 1991| orig-year = 1952| publisher = North-Holland Publishing Company| isbn = 978-0-7204-2103-3 }} [255] => * {{cite book| last = Knuth| first = Donald| author-link = Donald Knuth| title = Fundamental Algorithms, Third Edition| year = 1997| publisher = Addison–Wesley| location = Reading, Massachusetts| isbn = 978-0-201-89683-1 }} [256] => * {{Cite book|last=Knuth|first=Donald|author-link=Donald Knuth|title=Volume 2/Seminumerical Algorithms, The Art of Computer Programming First Edition|publisher=Addison–Wesley|location=Reading, Massachusetts|year=1969}} [257] => * Kosovsky, N.K. ''Elements of Mathematical Logic and its Application to the theory of Subrecursive Algorithms'', LSU Publ., Leningrad, 1981 [258] => * {{Cite journal|last=Kowalski|first=Robert|author-link=Robert Kowalski|title=Algorithm=Logic+Control|journal=[[Communications of the ACM]]|volume=22|issue=7|pages=424–436|year=1979|doi=10.1145/359131.359136|s2cid=2509896|doi-access=free}} [259] => * [[A.A. Markov]] (1954) ''Theory of algorithms''. [Translated by Jacques J. Schorr-Kon and PST staff] Imprint Moscow, Academy of Sciences of the USSR, 1954 [i.e., Jerusalem, Israel Program for Scientific Translations, 1961; available from the Office of Technical Services, U.S. Dept. of Commerce, Washington] Description 444 p. 28 cm. Added t.p. in Russian Translation of Works of the Mathematical Institute, Academy of Sciences of the USSR, v. 42. Original title: Teoriya algerifmov. [QA248.M2943 Dartmouth College library. U.S. Dept. of Commerce, Office of Technical Services, number OTS {{not a typo|60-51085}}.] [260] => * {{cite book| last = Minsky| first = Marvin| author-link = Marvin Minsky| title = Computation: Finite and Infinite Machines| url = https://archive.org/details/computationfinit0000mins| url-access = registration| edition = First| year = 1967| publisher = Prentice-Hall, Englewood Cliffs, NJ| isbn = 978-0-13-165449-5 }} Minsky expands his "...idea of an algorithm – an effective procedure..." in chapter 5.1 ''Computability, Effective Procedures and Algorithms. Infinite machines.'' [261] => * {{Cite journal|last=Post|first=Emil|author-link=Emil Post|title=Finite Combinatory Processes, Formulation I |journal=The Journal of Symbolic Logic |volume=1 |year=1936 |pages=103–105 |doi=10.2307/2269031 |issue=3 |jstor=2269031|s2cid=40284503 }} Reprinted in ''The Undecidable'', pp. 289ff. Post defines a simple algorithmic-like process of a man writing marks or erasing marks and going from box to box and eventually halting, as he follows a list of simple instructions. This is cited by Kleene as one source of his "Thesis I", the so-called [[Church–Turing thesis]]. [262] => * {{Cite book|last=Rogers|first=Hartley Jr.|title=Theory of Recursive Functions and Effective Computability|publisher=The MIT Press|year=1987|isbn=978-0-262-68052-3}} [263] => * {{Cite journal|last=Rosser|first=J.B.|author-link=J. B. Rosser|title=An Informal Exposition of Proofs of Godel's Theorem and Church's Theorem|journal=Journal of Symbolic Logic|volume= 4 |issue=2|year=1939|doi=10.2307/2269059|pages=53–60|jstor=2269059|s2cid=39499392 }} Reprinted in ''The Undecidable'', p. 223ff. Herein is Rosser's famous definition of "effective method": "...a method each step of which is precisely predetermined and which is certain to produce the answer in a finite number of steps... a machine which will then solve any problem of the set with no human intervention beyond inserting the question and (later) reading the answer" (p. 225–226, ''The Undecidable'') [264] => * {{cite book |last=Santos-Lang |first=Christopher |editor1-first=Simon |editor1-last=van Rysewyk |editor2-first=Matthijs |editor2-last=Pontier |title=Machine Medical Ethics |volume=74 |publisher=Springer | location=Switzerland | pages=111–127 | chapter=Moral Ecology Approaches to Machine Ethics| chapter-url=http://grinfree.com/MoralEcology.pdf |archive-url=https://ghostarchive.org/archive/20221009/http://grinfree.com/MoralEcology.pdf |archive-date=2022-10-09 |url-status=live | doi=10.1007/978-3-319-08108-3_8|series=Intelligent Systems, Control and Automation: Science and Engineering |date=2015 |isbn=978-3-319-08107-6 }} [265] => * {{Cite book|last=Scott|first=Michael L.|title=Programming Language Pragmatics |edition=3rd |publisher=Morgan Kaufmann Publishers/Elsevier|year=2009|isbn=978-0-12-374514-9}} [266] => * {{cite book| last = Sipser| first = Michael| title = Introduction to the Theory of Computation| year = 2006| publisher = PWS Publishing Company| isbn = 978-0-534-94728-6| url = https://archive.org/details/introductiontoth00sips}} [267] => * {{cite book |last1=Sober |first1=Elliott |last2=Wilson |first2=David Sloan |year=1998 |title=Unto Others: The Evolution and Psychology of Unselfish Behavior |url=https://archive.org/details/untoothersevolut00sobe |url-access=registration |location=Cambridge |publisher=Harvard University Press|isbn=9780674930469 }} [268] => * {{Cite book|last=Stone|first=Harold S.|title=Introduction to Computer Organization and Data Structures|edition=1972|publisher=McGraw-Hill, New York|isbn=978-0-07-061726-1|year=1972}} Cf. in particular the first chapter titled: ''Algorithms, Turing Machines, and Programs''. His succinct informal definition: "...any sequence of instructions that can be obeyed by a robot, is called an ''algorithm''" (p. 4). [269] => * {{cite book| last = Tausworthe| first = Robert C| title = Standardized Development of Computer Software Part 1 Methods| year = 1977| publisher = Prentice–Hall, Inc.| location = Englewood Cliffs NJ| isbn = 978-0-13-842195-3 }} [270] => * {{Cite journal|last=Turing|first=Alan M.|author-link=A. M. Turing|title=On Computable Numbers, With An Application to the Entscheidungsproblem|journal=[[Proceedings of the London Mathematical Society]]|series=Series 2|volume=42|pages= 230–265 |year=1936–37|doi=10.1112/plms/s2-42.1.230 |s2cid=73712 }}. Corrections, ibid, vol. 43(1937) pp. 544–546. Reprinted in ''The Undecidable'', p. 116ff. Turing's famous paper completed as a Master's dissertation while at King's College Cambridge UK. [271] => * {{Cite journal|last=Turing|first=Alan M.|author-link=A. M. Turing|title=Systems of Logic Based on Ordinals|journal=Proceedings of the London Mathematical Society|volume=45|pages=161–228|year=1939|doi=10.1112/plms/s2-45.1.161|hdl=21.11116/0000-0001-91CE-3|hdl-access=free}} Reprinted in ''The Undecidable'', pp. 155ff. Turing's paper that defined "the oracle" was his PhD thesis while at Princeton. [272] => * [[United States Patent and Trademark Office]] (2006), [http://www.uspto.gov/web/offices/pac/mpep/documents/2100_2106_02.htm ''2106.02 **>Mathematical Algorithms: 2100 Patentability''], Manual of Patent Examining Procedure (MPEP). Latest revision August 2006 [273] => {{refend|30em}} [274] => * Zaslavsky, C. (1970). Mathematics of the Yoruba People and of Their Neighbors in Southern Nigeria. The Two-Year College Mathematics Journal, 1(2), 76–99. https://doi.org/10.2307/3027363 [275] => [276] => ==Further reading== [277] => {{refbegin}} [278] => * {{cite book |last=Bellah |first=Robert Neelly |year=1985 |author-link=Robert N. Bellah |title=Habits of the Heart: Individualism and Commitment in American Life |location=Berkeley |isbn=978-0-520-25419-0 |publisher=University of California Press |url=https://books.google.com/books?id=XsUojihVZQcC }} [279] => * {{cite book |last=Berlinski |first=David |title=The Advent of the Algorithm: The 300-Year Journey from an Idea to the Computer |year=2001 |publisher=Harvest Books |isbn=978-0-15-601391-8 |url=https://archive.org/details/adventofalgorith0000berl }} [280] => * {{cite book |last=Chabert |first=Jean-Luc |title=A History of Algorithms: From the Pebble to the Microchip |year=1999 |publisher=Springer Verlag |isbn=978-3-540-63369-3}} [281] => * {{cite book |author1=Thomas H. Cormen |author2=Charles E. Leiserson |author3=Ronald L. Rivest |author4=Clifford Stein |title=Introduction To Algorithms |edition=3rd |year=2009 |publisher=MIT Press |isbn=978-0-262-03384-8}} [282] => * {{cite book |author=Harel, David |author2=Feldman, Yishai |title=Algorithmics: The Spirit of Computing |year=2004 |publisher=Addison-Wesley |isbn=978-0-321-11784-7}} [283] => * {{cite book |last1=Hertzke |first1=Allen D. |last2=McRorie |first2=Chris |year=1998 |editor1-last=Lawler |editor1-first=Peter Augustine |editor2-last=McConkey |editor2-first=Dale |chapter=The Concept of Moral Ecology |title=Community and Political Thought Today |location=Westport, CT |publisher=[[Praeger Publishers|Praeger]] }} [284] => * [[Donald Knuth|Knuth, Donald E.]] (2000). ''[http://www-cs-faculty.stanford.edu/~uno/aa.html Selected Papers on Analysis of Algorithms] {{Webarchive|url=https://web.archive.org/web/20170701190647/http://www-cs-faculty.stanford.edu/~uno/aa.html |date=July 1, 2017 }}''. Stanford, California: Center for the Study of Language and Information. [285] => * Knuth, Donald E. (2010). ''[http://www-cs-faculty.stanford.edu/~uno/da.html Selected Papers on Design of Algorithms] {{Webarchive|url=https://web.archive.org/web/20170716225848/http://www-cs-faculty.stanford.edu/~uno/da.html |date=July 16, 2017 }}''. Stanford, California: Center for the Study of Language and Information. [286] => * {{Cite book |first1=Wendell |last1=Wallach |first2=Colin |last2=Allen |date=November 2008 |title=Moral Machines: Teaching Robots Right from Wrong |isbn=978-0-19-537404-9 |publisher=Oxford University Press |location=US }} [287] => * {{cite book |author=Bleakley, Chris |title=Poems that Solve Puzzles: The History and Science of Algorithms |year=2020 |publisher=Oxford University Press |isbn=978-0-19-885373-2 |url=https://books.google.com/books?id=3pr5DwAAQBAJ }} [288] => {{refend}} [289] => [290] => ==External links== [291] => {{wiktionary}} [292] => {{wikibooks|Algorithms}} [293] => {{Wikiversity department}} [294] => {{Commons category|Algorithms}} [295] => * {{springer|title=Algorithm|id=p/a011780|mode=cs1}} [296] => * {{curlie|Computers/Algorithms/|Algorithms}} [297] => * {{MathWorld | urlname=Algorithm | title=Algorithm}} [298] => * [https://www.nist.gov/dads/ Dictionary of Algorithms and Data Structures] – [[National Institute of Standards and Technology]] [299] => ; Algorithm repositories [300] => * [http://www.cs.sunysb.edu/~algorith/ The Stony Brook Algorithm Repository] – [[State University of New York at Stony Brook]] [301] => * [http://calgo.acm.org/ Collected Algorithms of the ACM] – [[Association for Computing Machinery|Associations for Computing Machinery]] [302] => * [http://www-cs-staff.stanford.edu/~knuth/sgb.html The Stanford GraphBase] {{Webarchive|url=https://web.archive.org/web/20151206222112/http://www-cs-staff.stanford.edu/%7Eknuth/sgb.html |date=December 6, 2015 }} – [[Stanford University]] [303] => [304] => {{Industrial and applied mathematics}} [305] => {{Algorithmic paradigms}} [306] => {{Authority control}} [307] => [[Category:Algorithms| ]] [308] => [[Category:Articles with example pseudocode]] [309] => [[Category:Mathematical logic]] [310] => [[Category:Theoretical computer science]] [] => )
good wiki

Algorithm

An algorithm is a mathematical or logical formula designed to solve a specific problem or complete a specific task. It is a well-defined set of rules or instructions that a computer program follows to perform a particular operation.

More about us

About

It is a well-defined set of rules or instructions that a computer program follows to perform a particular operation. In simple terms, an algorithm can be thought of as a step-by-step procedure for solving a problem. Algorithms can be found in various fields, including computer science, mathematics, economics, and engineering. They are used to perform tasks such as sorting data, searching for information, optimizing processes, and making decisions. The Wikipedia page on algorithms provides a comprehensive overview of the subject. It covers different types of algorithms, including sorting algorithms, searching algorithms, graph algorithms, and cryptography algorithms. The page also describes the process of algorithm analysis, which involves studying the efficiency and effectiveness of an algorithm. The history of algorithms is explored, highlighting the contributions of notable mathematicians and computer scientists over the years. The page also discusses the impact of algorithms on society, particularly in the areas of artificial intelligence, machine learning, and data analysis. Additionally, the Wikipedia page provides examples of popular algorithms, such as the binary search algorithm, Dijkstra's algorithm, and the RSA encryption algorithm. It also mentions algorithmic complexity, including time complexity and space complexity, which help measure the efficiency of algorithms. Overall, the Wikipedia page on algorithms serves as a valuable resource for anyone interested in understanding the fundamental concepts, applications, and advancements in the world of algorithms.

Expert Team

Vivamus eget neque lacus. Pellentesque egauris ex.

Award winning agency

Lorem ipsum, dolor sit amet consectetur elitorceat .

10 Year Exp.

Pellen tesque eget, mauris lorem iupsum neque lacus.