id
stringlengths
14
20
title
stringlengths
4
181
text
stringlengths
1
43k
source
stringclasses
1 value
wiki_3_chunk_131
American Revolutionary War
In the western theater of the American Revolutionary War, conflicts between settlers and Native Americans led to lingering distrust. In the 1783 Treaty of Paris, Great Britain ceded control of the disputed lands between the Great Lakes and the Ohio River, but the Indian inhabitants were not a part of the peace negotiat...
wikipedia
wiki_3_chunk_132
American Revolutionary War
Lord North, Prime Minister since 1770, delegated control of the war in North America to Lord George Germain and the Earl of Sandwich, who was head of the Royal Navy from 1771 to 1782. Defeat at Saratoga in 1777 made it clear the revolt would not be easily suppressed, especially after the Franco-American alliance of Feb...
wikipedia
wiki_3_chunk_133
American Revolutionary War
British negotiators now proposed a second peace settlement to Congress. The terms presented by the Carlisle Peace Commission included acceptance of the principle of self-government. Parliament would recognize Congress as the governing body, suspend any objectionable legislation, surrender its right to local colonial ta...
wikipedia
wiki_3_chunk_134
American Revolutionary War
When the commissioners returned to London in November 1778, they recommended a change in policy. Sir Henry Clinton, the new British Commander-in-Chief in America, was ordered to stop treating the rebels as enemies, rather than subjects whose loyalty might be regained. Those standing orders would be in effect for three ...
wikipedia
wiki_3_chunk_135
American Revolutionary War
North initially backed the Southern strategy attempting to exploit divisions between the mercantile north and slave-owning south, but after the defeat of Yorktown, he was forced to accept the fact that this policy had failed. It was clear the war was lost, although the Royal Navy forced the French to relocate their fle...
wikipedia
wiki_3_chunk_136
American Revolutionary War
On February 27, 1782, a Whig motion to end the offensive war in America was carried by 19 votes. North now resigned, obliging the king to invite Lord Rockingham to form a government; a consistent supporter of the Patriot cause, he made a commitment to US independence a condition of doing so. George III reluctantly acce...
wikipedia
wiki_3_chunk_137
American Revolutionary War
When Lord Rockingham, the Whig leader and friend of the American cause was elevated to Prime Minister, Congress consolidated its diplomatic consuls in Europe into a peace delegation at Paris. All were experienced in Congressional leadership. The dean of the delegation was Benjamin Franklin of Pennsylvania. He had becom...
wikipedia
wiki_3_chunk_138
American Revolutionary War
The Whig negotiators for Lord Rockingham and his successor, Prime Minister Lord Shelburne, included long-time friend of Benjamin Franklin from his time in London, David Hartley and Richard Oswald, who had negotiated Laurens' release from the Tower of London. The Preliminary Peace signed on November 30 met four key Cong...
wikipedia
wiki_3_chunk_139
American Revolutionary War
British strategy was to strengthen the US sufficiently to prevent France from regaining a foothold in North America, and they had little interest in these proposals. However, divisions between their opponents allowed them to negotiate separately with each to improve their overall position, starting with the American de...
wikipedia
wiki_3_chunk_140
American Revolutionary War
Facing difficulties with Spain over claims involving the Mississippi River, and from France who was still reluctant to agree to American independence until all her demands were met, John Jay promptly told the British that he was willing to negotiate directly with them, cutting off France and Spain, and Prime Minister L...
wikipedia
wiki_3_chunk_141
American Revolutionary War
An Anglo-American Preliminary Peace was formally entered into in November 1782, and Congress endorsed the settlement on April 15, 1783. It announced the achievement of peace with independence; the "conclusive" treaty was signed on September 2, 1783, in Paris, effective the next day September 3, when Britain signed its ...
wikipedia
wiki_3_chunk_142
American Revolutionary War
Aftermath Washington expressed astonishment that the Americans had won a war against a leading world power, referring to the American victory as "little short of a standing miracle". The conflict between British subjects with the Crown against those with the Congress had lasted over eight years from 1775 to 1783. The l...
wikipedia
wiki_3_chunk_143
American Revolutionary War
On April 9, 1783, Washington issued orders that he had long waited to give, that "all acts of hostility" were to cease immediately. That same day, by arrangement with Washington, General Carleton issued a similar order to British troops. British troops, however, were not to evacuate until a prisoner of war exchange occ...
wikipedia
wiki_3_chunk_144
American Revolutionary War
As directed by a Congressional resolution of May 26, 1783, all non-commissioned officers and enlisted were furloughed "to their homes" until the "definitive treaty of peace", when they would be automatically discharged. The US armies were directly disbanded in the field as of Washington's General Orders on Monday, June...
wikipedia
wiki_3_chunk_145
American Revolutionary War
The expanse of territory that was now the United States was ceded from its colonial Mother country alone. It included millions of sparsely settled acres south of the Great Lakes Line between the Appalachian Mountains and the Mississippi River. The tentative colonial migration west became a flood during the years of the...
wikipedia
wiki_3_chunk_146
American Revolutionary War
Britain's extended post-war policy for the US continued to try to establish an Indian buffer state below the Great Lakes as late as 1814 during the War of 1812. The formally acquired western American lands continued to be populated by a dozen or so American Indian tribes that had been British allies for the most part. ...
wikipedia
wiki_3_chunk_147
American Revolutionary War
While tribes were not consulted by the British for the treaty, in practice the British refused to abandon the forts on territory they formally transferred. Instead, they provisioned military allies for continuing frontier raids and sponsored the Northwest Indian War (1785–1795), including erecting an additional British...
wikipedia
wiki_3_chunk_148
American Revolutionary War
Of the European powers with American colonies adjacent to the newly created United States, Spain was most threatened by American independence, and it was correspondingly the most hostile to it. Its territory adjacent to the US was relatively undefended, so Spanish policy developed a combination of initiatives. Spanish ...
wikipedia
wiki_3_chunk_149
American Revolutionary War
Casualties and losses The total loss of life throughout the conflict is largely unknown. As was typical in wars of the era, diseases such as smallpox claimed more lives than battle. Between 1775 and 1782, a smallpox epidemic broke out throughout North America, killing an estimated 130,000 among all its populations duri...
wikipedia
wiki_3_chunk_150
American Revolutionary War
Up to 70,000 American Patriots died during active military service. Of these, approximately 6,800 were killed in battle, while at least 17,000 died from disease. The majority of the latter died while prisoners of war of the British, mostly in the prison ships in New York Harbor. The number of Patriots seriously wounded...
wikipedia
wiki_3_chunk_151
American Revolutionary War
A British report in 1781 puts their total Army deaths at 6,046 in North America (1775–1779). Approximately 7,774 Germans died in British service in addition to 4,888 deserters; of the former, it is estimated 1,800 were killed in combat. Legacy
wikipedia
wiki_3_chunk_152
American Revolutionary War
The American Revolution established the United States with its numerous civil liberties and set an example to overthrow both monarchy and colonial governments. The United States has the world's oldest written constitution, and the constitutions of other free countries often bear a striking resemblance to the US Constit...
wikipedia
wiki_3_chunk_153
American Revolutionary War
Although the Revolution eliminated many forms of inequality, it did little to change the status of women, despite the role they played in winning independence. Most significantly, it failed to end slavery which continued to be a serious social and political issue and caused divisions that would ultimately end in civil ...
wikipedia
wiki_3_chunk_154
American Revolutionary War
In 1782, Virginia passed a law permitting manumission and over the next eight years more than 10,000 slaves were given their freedom. With support from Benjamin Franklin, in 1790 the Quakers petitioned Congress to abolish slavery; the number of abolitionist movements greatly increased, and by 1804 all the northern stat...
wikipedia
wiki_3_chunk_155
American Revolutionary War
Historiography A large historiography concerns the reasons the Americans revolted and successfully broke away. The "Patriots", an insulting term used by the British that was proudly adopted by the Americans, stressed the constitutional rights of Englishmen, especially "No taxation without representation." Contemporari...
wikipedia
wiki_3_chunk_156
American Revolutionary War
The Atlantic history view places the American story in a broader context, including revolutions in France and Haiti. It tends to reintegrate the historiographies of the American Revolution and the British Empire. The "new social history" approach looks at community social structure to find cleavages that were magnified...
wikipedia
wiki_3_chunk_157
American Revolutionary War
The ideological approach that centers on republicanism in the United States. Republicanism dictated there would be no royalty, aristocracy or national church but allowed for continuation of the British common law, which American lawyers and jurists understood and approved and used in their everyday practice. Historians...
wikipedia
wiki_3_chunk_158
American Revolutionary War
Commemorations of the Revolutionary War After the first U.S. postage stamp was issued in 1849, the U.S. Post Office frequently issued commemorative stamps celebrating the various people and events of the Revolutionary War. However, it would be more than 140 years after the Revolution before any stamp commemorating that...
wikipedia
wiki_3_chunk_159
American Revolutionary War
Topics of the Revolution Committee of safety (American Revolution) Financial costs of the American Revolutionary War Flags of the American Revolution Naval operations in the American Revolutionary War Social history of the Revolution Black Patriot Christianity in the United States#American Revolution The Colored...
wikipedia
wiki_3_chunk_160
American Revolutionary War
Lists of Revolutionary military List of American Revolutionary War battles List of British Forces in the American Revolutionary War List of Continental Forces in the American Revolutionary War List of infantry weapons in the American Revolution List of United States militia units in the American Revolutionary War ...
wikipedia
wiki_3_chunk_161
American Revolutionary War
Legacy and related American Revolution Statuary Commemoration of the American Revolution Founders Online Independence Day (United States) The Last Men of the Revolution List of plays and films about the American Revolution Museum of the American Revolution Tomb of the Unknown Soldier of the American Revolution ...
wikipedia
wiki_3_chunk_162
American Revolutionary War
– Highly regarded examination of British strategy and leadership. An introduction by John W. Shy with his biographical sketch of Mackesy. Robinson Library (See also:British Warships in the Age of Sail) Websites without authors Canada's Digital Collections Program History.org Maryland State House The History Pl...
wikipedia
wiki_3_chunk_163
American Revolutionary War
Allison, David, and Larrie D. Ferreiro, eds. The American Revolution: A World War (Smithsonian, 2018) excerpt Volumes committed to the American Revolution: Vol. 7; Vol. 8; Vol. 9; Vol. 10 Bobrick, Benson. Angel in the Whirlwind: The Triumph of the American Revolution. Penguin, 1998 (paperback reprint) Char...
wikipedia
wiki_3_chunk_164
American Revolutionary War
Primary sources In addition to this selection, many primary sources are available at the Princeton University Law School Avalon Project and at the Library of Congress Digital Collections (previously LOC webpage, American Memory). Original editions for titles related to the American Revolutionary War can be found open-s...
wikipedia
wiki_3_chunk_165
American Revolutionary War
Bibliographies online Library of Congress Guide to the American Revolution Bibliographies of the War of American Independence compiled by the United States Army Center of Military History Political bibliography from Omohundro Institute of Early American History and Culture Conflicts in 1775 Conflicts in 1776 Conflic...
wikipedia
wiki_4_chunk_0
Algorithm
In mathematics and computer science, an algorithm () is a finite sequence of well-defined instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing calculations and data processing. By making use of artificial intelligence, algor...
wikipedia
wiki_4_chunk_1
Algorithm
In contrast, a 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.
wikipedia
wiki_4_chunk_2
Algorithm
As an effective method, an algorithm can be expressed within a finite amount of space and time, and in a well-defined formal language for calculating a function. Starting from an initial state and initial input (perhaps empty), the instructions describe a computation that, when executed, proceeds through a finite numbe...
wikipedia
wiki_4_chunk_3
Algorithm
History The concept of algorithm has existed since antiquity. Arithmetic algorithms, such as a division algorithm, were used by ancient Babylonian mathematicians c. 2500 BC and Egyptian mathematicians c. 1550 BC. Greek mathematicians later used algorithms in 240 BC in the sieve of Eratosthenes for finding prime number...
wikipedia
wiki_4_chunk_4
Algorithm
The word algorithm is derived from the name of the 9th-century Persian mathematician Muḥammad ibn Mūsā al-Khwārizmī, whose nisba (identifying him as from Khwarazm) was Latinized as Algoritmi (Arabized Persian الخوارزمی c. 780–850). Muḥammad ibn Mūsā al-Khwārizmī was a mathematician, astronomer, geographer, and scholar ...
wikipedia
wiki_4_chunk_5
Algorithm
Indian mathematics was predominantly algorithmic. Algorithms that are representative of the Indian mathematical tradition range from the ancient Śulbasūtrās to the medieval texts of the Kerala School. In English, the word algorithm was first used in about 1230 and then by Chaucer in 1391. English adopted the French ter...
wikipedia
wiki_4_chunk_6
Algorithm
The poem is a few hundred lines long and summarizes the art of calculating with the new styled Indian dice (Tali Indorum), or Hindu numerals.
wikipedia
wiki_4_chunk_7
Algorithm
A partial formalization of the modern concept of algorithm began with attempts to solve the Entscheidungsproblem (decision problem) posed by David Hilbert in 1928. Later formalizations were framed as attempts to define "effective calculability" or "effective method". Those formalizations included the Gödel–Herbrand–Kl...
wikipedia
wiki_4_chunk_8
Algorithm
An informal definition could be "a set of rules that precisely defines a sequence of operations", which would include all computer programs (including programs that do not perform numeric calculations), and (for example) any prescribed bureaucratic procedure or cook-book recipe. In general, a program is only an algorit...
wikipedia
wiki_4_chunk_9
Algorithm
offer an informal meaning of the word "algorithm" in the following quotation:
wikipedia
wiki_4_chunk_10
Algorithm
No human being can write fast enough, or long enough, or small enough† ( †"smaller and smaller without limit ... you'd be trying to write on molecules, on atoms, on electrons") to list all members of an enumerably infinite set by writing out their names, one after another, in some notation. But humans can do something ...
wikipedia
wiki_4_chunk_11
Algorithm
An "enumerably infinite set" is one whose elements can be put into one-to-one correspondence with the integers. Thus Boolos and Jeffrey are saying that an algorithm implies instructions for a process that "creates" output integers from an arbitrary "input" integer or integers that, in theory, can be arbitrarily large. ...
wikipedia
wiki_4_chunk_12
Algorithm
The concept of algorithm is also used to define the notion of decidability—a notion that is central for explaining how formal systems come into being starting from a small set of axioms and rules. In logic, the time that an algorithm requires to complete cannot be measured, as it is not apparently related to the custom...
wikipedia
wiki_4_chunk_13
Algorithm
Most algorithms are intended to be implemented as computer programs. 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. Formalization
wikipedia
wiki_4_chunk_14
Algorithm
Algorithms are essential to the way computers process data. Many computer programs contain algorithms that detail the specific instructions a computer should perform—in a specific order—to carry out a specified task, such as calculating employees' paychecks or printing students' report cards. Thus, an algorithm can be ...
wikipedia
wiki_4_chunk_15
Algorithm
Gurevich: "… Turing's informal argument in favor of his thesis justifies a stronger thesis: every algorithm can be simulated by a Turing machine … according to Savage [1987], an algorithm is a computational process defined by a Turing machine".Turing machines can define computational processes that do not terminate. Th...
wikipedia
wiki_4_chunk_16
Algorithm
Typically, when an algorithm is associated with processing information, data can be read from an input source, written to an output device and stored for further processing. Stored data are regarded as part of the internal state of the entity performing the algorithm. In practice, the state is stored in one or more dat...
wikipedia
wiki_4_chunk_17
Algorithm
Because an algorithm is a precise list of precise steps, the order of computation is always crucial 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 o...
wikipedia
wiki_4_chunk_18
Algorithm
So far, the discussion on the formalization of an algorithm has assumed the premises of imperative programming. This is the most common conception—one which attempts to describe a task in discrete, "mechanical" means. Unique to this conception of formalized algorithms is the assignment operation, which sets the value o...
wikipedia
wiki_4_chunk_19
Algorithm
Expressing algorithms Algorithms can be expressed in many kinds of notation, including natural languages, pseudocode, flowcharts, drakon-charts, programming languages or control tables (processed by interpreters). Natural language expressions of algorithms tend to be verbose and ambiguous, and are rarely used for compl...
wikipedia
wiki_4_chunk_20
Algorithm
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 ...
wikipedia
wiki_4_chunk_21
Algorithm
Representations of algorithms can be classed into three accepted levels of Turing machine description, as follows: 1 High-level description "...prose to describe an algorithm, ignoring the implementation details. At this level, we do not need to mention how the machine manages its tape or head." 2 Implementation des...
wikipedia
wiki_4_chunk_22
Algorithm
For an example of the simple algorithm "Add m+n" described in all three levels, see Examples. Design 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 of operation research, such as dynamic programming...
wikipedia
wiki_4_chunk_23
Algorithm
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. Typical steps in the development of algorithms: Problem definition Development of a model Specification...
wikipedia
wiki_4_chunk_24
Algorithm
"Elegant" (compact) programs, "good" (fast) programs : The notion of "simplicity and elegance" appears informally in Knuth and precisely in Chaitin: Knuth: " ... we want good algorithms in some loosely defined aesthetic sense. One criterion ... is the length of time taken to perform the algorithm .... Other criteria ar...
wikipedia
wiki_4_chunk_25
Algorithm
Chaitin prefaces his definition with: "I'll show you can't prove that a program is 'elegant—such a proof would solve the Halting problem (ibid). Algorithm versus function computable by an algorithm: For a given function multiple algorithms may exist. This is true, even without expanding the available instruction set av...
wikipedia
wiki_4_chunk_26
Algorithm
Unfortunately, there may be a tradeoff between goodness (speed) and elegance (compactness)—an elegant program may take more steps to complete a computation than one less elegant. An example that uses Euclid's algorithm appears below.
wikipedia
wiki_4_chunk_27
Algorithm
Computers (and computors), models of computation: A computer (or human "computor") is a restricted type of machine, a "discrete deterministic mechanical device" that blindly follows its instructions. Melzak's and Lambek's primitive models reduced this notion to four elements: (i) discrete, distinguishable locations, (i...
wikipedia
wiki_4_chunk_28
Algorithm
Minsky describes a more congenial variation of Lambek's "abacus" model in his "Very Simple Bases for Computability". Minsky's machine proceeds sequentially through its five (or six, depending on how one counts) instructions unless either a conditional IF-THEN GOTO or an unconditional GOTO changes program flow out of se...
wikipedia
wiki_4_chunk_29
Algorithm
Simulation of an algorithm: computer (computor) language: Knuth advises the reader that "the best way to learn an algorithm is to try it . . . immediately take pen and paper and work through an example". But what about a simulation or execution of the real thing? The programmer must translate the algorithm into a langu...
wikipedia
wiki_4_chunk_30
Algorithm
This means that the programmer must know a "language" that is effective relative to the target computing agent (computer/computor).
wikipedia
wiki_4_chunk_31
Algorithm
But what model should be used for the simulation? Van Emde Boas observes "even if we base complexity theory on abstract instead of concrete machines, arbitrariness of the choice of a model remains. It is at this point that the notion of simulation enters". When speed is being measured, the instruction set matters. For ...
wikipedia
wiki_4_chunk_32
Algorithm
Structured programming, canonical structures: Per the Church–Turing thesis, any algorithm can be computed by a model known to be Turing complete, and per Minsky's demonstrations, Turing completeness requires only four instruction types—conditional GOTO, unconditional GOTO, assignment, HALT. Kemeny and Kurtz observe tha...
wikipedia
wiki_4_chunk_33
Algorithm
Canonical flowchart symbols: The graphical aide called a flowchart, offers a way to describe and document an algorithm (and a computer program of one). 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 showi...
wikipedia
wiki_4_chunk_34
Algorithm
Examples Algorithm example 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:
wikipedia
wiki_4_chunk_35
Algorithm
High-level description: If there are no numbers in the set then there is no highest number. Assume the first number in the set is the largest number in the set. 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. W...
wikipedia
wiki_4_chunk_36
Algorithm
(Quasi-)formal description: 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: Input: A list of numbers L. Output: The largest number in the list L. if L.size = 0 return null largest ← L[0] fo...
wikipedia
wiki_4_chunk_37
Algorithm
Euclid's algorithm In mathematics, the Euclidean algorithm, or Euclid's algorithm, is an efficient method for computing the greatest common divisor (GCD) of two integers (numbers), the largest number that divides them both without a remainder. It is named after the ancient Greek mathematician Euclid, who first describe...
wikipedia
wiki_4_chunk_38
Algorithm
Euclid poses the problem thus: "Given two numbers not prime to one another, to find their greatest common measure". He defines "A number [to be] a multitude composed of units": a counting number, a positive integer not including zero. To "measure" is to place a shorter measuring length s successively (q times) along lo...
wikipedia
wiki_4_chunk_39
Algorithm
For Euclid's method to succeed, the starting lengths must satisfy two requirements: (i) the lengths must not be zero, AND (ii) the subtraction must be "proper"; i.e., a test must guarantee that the smaller of the two numbers is subtracted from the larger (or the two can be equal so their subtraction yields zero).
wikipedia
wiki_4_chunk_40
Algorithm
Euclid's original proof adds a third requirement: the two lengths must not be prime to one another. Euclid stipulated this so that he could construct a reductio ad absurdum proof that the two numbers' common measure is in fact the greatest. While Nicomachus' algorithm is the same as Euclid's, when the numbers are prime...
wikipedia
wiki_4_chunk_41
Algorithm
Computer language for Euclid's algorithm Only a few instruction types are required to execute Euclid's algorithm—some logical tests (conditional GOTO), unconditional GOTO, assignment (replacement), and subtraction. A location is symbolized by upper case letter(s), e.g. S, A, etc. The varying quantity (number) in a lo...
wikipedia
wiki_4_chunk_42
Algorithm
An inelegant program for Euclid's algorithm The following algorithm is framed as Knuth's four-step version of Euclid's and Nicomachus', but, rather than using division to find the remainder, it uses successive subtractions of the shorter length s from the remaining length r until r is less than s. The high-level descri...
wikipedia
wiki_4_chunk_43
Algorithm
INPUT: [Into two locations L and S put the numbers l and s that represent the two lengths]: INPUT L, S [Initialize R: make the remaining length r equal to the starting/initial/input length l]: R ← L
wikipedia
wiki_4_chunk_44
Algorithm
E0: [Ensure r ≥ s.] [Ensure the smaller of the two numbers is in S and the larger in R]: IF R > S THEN the contents of L is the larger number so skip over the exchange-steps 4, 5 and 6: GOTO step 7 ELSE swap the contents of R and S. L ← R (this first step is redundant, but is useful for later...
wikipedia
wiki_4_chunk_45
Algorithm
E1: [Find remainder]: Until the remaining length r in R is less than the shorter length s in S, repeatedly subtract the measuring number s in S from the remaining length r in R. IF S > R THEN done measuring so GOTO 10 ELSE measure again, R ← R − S [Remainder-loop]: GOTO 7.
wikipedia
wiki_4_chunk_46
Algorithm
E2: [Is the remainder zero?]: EITHER (i) the last measure was exact, the remainder in R is zero, and the program can halt, OR (ii) the algorithm must continue: the last measure left a remainder in R less than measuring number in S. IF R = 0 THEN done so GOTO step 15 ELSE CONTINUE TO step 11,
wikipedia
wiki_4_chunk_47
Algorithm
E3: [Interchange s and r]: The nut of Euclid's algorithm. Use remainder r to measure what was previously smaller number s; L serves as a temporary location. L ← R R ← S S ← L [Repeat the measuring process]: GOTO 7 OUTPUT: [Done. S contains the greatest common divisor]: PRINT S DONE: HALT, END, ST...
wikipedia
wiki_4_chunk_48
Algorithm
An elegant program for Euclid's algorithm The flowchart of "Elegant" can be found at the top of this article. In the (unstructured) Basic language, the steps are numbered, and the instruction LET [] = [] is the assignment instruction symbolized by ←. 5 REM Euclid's algorithm for greatest common divisor 6 PRINT "Ty...
wikipedia
wiki_4_chunk_49
Algorithm
The following version can be used with programming languages from the C-family: // Euclid's algorithm for greatest common divisor int euclidAlgorithm (int A, int B){ A=abs(A); B=abs(B); while (B!=0){ while (A>B) A=A-B; B=B-A; } return A; }
wikipedia
wiki_4_chunk_50
Algorithm
Testing the Euclid algorithms Does an algorithm do what its author wants it to do? A few test cases usually give some confidence in the core functionality. But tests are not enough. For test cases, one source uses 3009 and 884. Knuth suggested 40902, 24140. Another interesting case is the two relatively prime numbers 1...
wikipedia
wiki_4_chunk_51
Algorithm
But "exceptional cases" must be identified and tested. Will "Inelegant" perform properly when R > S, S > R, R = S? Ditto for "Elegant": B > A, A > B, A = B? (Yes to all). What happens when one number is zero, both numbers are zero? ("Inelegant" computes forever in all cases; "Elegant" computes forever when A = 0.) What...
wikipedia
wiki_4_chunk_52
Algorithm
Proof of program correctness by use of mathematical induction: Knuth demonstrates the application of mathematical induction to an "extended" version of Euclid's algorithm, and he proposes "a general method applicable to proving the validity of any algorithm". Tausworthe proposes that a measure of the complexity of a pr...
wikipedia
wiki_4_chunk_53
Algorithm
Measuring and improving the Euclid algorithms Elegance (compactness) versus goodness (speed): With only six core instructions, "Elegant" is the clear winner, compared to "Inelegant" at thirteen instructions. However, "Inelegant" is faster (it arrives at HALT in fewer steps). Algorithm analysis indicates why this is the...
wikipedia
wiki_4_chunk_54
Algorithm
Can the algorithms be improved?: Once the programmer judges a program "fit" and "effective"—that is, it computes the function intended by its author—then the question becomes, can it be improved?
wikipedia
wiki_4_chunk_55
Algorithm
The compactness of "Inelegant" can be improved by the elimination of five steps. But Chaitin proved that compacting an algorithm cannot be automated by a generalized algorithm; rather, it can only be done heuristically; i.e., by exhaustive search (examples to be found at Busy beaver), trial and error, cleverness, insig...
wikipedia
wiki_4_chunk_56
Algorithm
The speed of "Elegant" can be improved by moving the "B=0?" test outside of the two subtraction loops. This change calls for the addition of three instructions (B = 0?, A = 0?, GOTO). Now "Elegant" computes the example-numbers faster; whether this is always the case for any given A, B, and R, S would require a detailed...
wikipedia
wiki_4_chunk_57
Algorithm
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 ...
wikipedia
wiki_4_chunk_58
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, a binary search algorithm (with cost O(log n)) outperforms a sequential search (cost O(n) ) when used for table lookups on sorted lists or arrays. Formal versus empiric...
wikipedia
wiki_4_chunk_59
Algorithm
The analysis, and study of algorithms 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 a...
wikipedia
wiki_4_chunk_60
Algorithm
Empirical testing is useful because it may uncover unexpected interactions that affect performance. Benchmarks may be used to compare before/after potential improvements to an algorithm after program optimization. Empirical tests cannot replace formal analysis, though, and are not trivial to perform in a fair manner. E...
wikipedia
wiki_4_chunk_61
Algorithm
To illustrate the potential improvements possible even in well-established algorithms, a recent significant innovation, relating to FFT algorithms (used heavily in the field of image processing), can decrease processing time up to 1,000 times for applications like medical imaging. In general, speed improvements depend ...
wikipedia
wiki_4_chunk_62
Algorithm
Recursion 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. Iterative algorithms use repetitive constructs like loops and sometimes additional data structures like...
wikipedia
wiki_4_chunk_63
Algorithm
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 includes many different types of algorithms. Some common paradigms are:
wikipedia
wiki_4_chunk_64
Algorithm
Brute-force or exhaustive search This is the naive method of trying every possible solution to see which is best. Divide and conquer A divide and conquer algorithm repeatedly reduces an instance of a problem to one or more smaller instances of the same problem (usually recursively) until the instances are small enou...
wikipedia