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 negotiations. Tribes in the Northwest Territory joined as the Western Confederacy and allied with the British to resist American settlement, and their conflict continued after the Revolutionary War as the Northwest Indian War. Britain's "American war" and peace Changing Prime Ministers
|
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 February 1778, and French declaration of war in June. With Spain also expected to join the conflict, the Royal Navy needed to prioritize either the war in America or in Europe; Germain advocated the former, Sandwich the latter.
|
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 taxation, and discuss including American representatives in the House of Commons. In return, all property confiscated from Loyalists would be returned, British debts honored, and locally enforced martial law accepted. However, Congress demanded either immediate recognition of independence or the withdrawal of all British troops; they knew the commission were not authorized to accept these, bringing negotiations to a rapid end.
|
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 years until Clinton was relieved.
|
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 fleet to the Caribbean in November 1781 and resumed a close blockade of American trade. The resulting economic damage and rising inflation meant the US was now eager to end the war, while France was unable to provide further loans; Congress could no longer pay its soldiers.
|
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 accepted and the new government took office on March 27, 1782; however, Rockingham died unexpectedly on July 1, and was replaced by Lord Shelburne who acknowledged American independence. American Congress signs a peace
|
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 become a celebrity in the French Court, but he was also an Enlightenment scientist with influence in the courts of European great powers in Prussia, England's former ally, and Austria, a Catholic empire like Spain. Since the 1760s he had been an organizer of British American inter-colony cooperation, and then a colonial lobbyist to Parliament in London. John Adams of Massachusetts had been consul to the Dutch Republic and was a prominent early New England Patriot. John Jay of New York had been consul to Spain and was a past president of the Continental Congress. As consul to the Dutch Republic, Henry Laurens of South Carolina had secured a preliminary agreement for a trade agreement. He had been a successor to John Jay as president of Congress and with Franklin was a member of the American Philosophical Society. Although active in the preliminaries, he was not a signer of the conclusive treaty.
|
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 Congressional demands: independence, territory up to the Mississippi, navigation rights into the Gulf of Mexico, and fishing rights in Newfoundland.
|
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 delegation in September 1782. The French and Spanish sought to improve their position by creating the U.S. dependent on them for support against Britain, thus reversing the losses of 1763. Both parties tried to negotiate a settlement with Britain excluding the Americans; France proposed setting the western boundary of the US along the Appalachians, matching the British 1763 Proclamation Line. The Spanish suggested additional concessions in the vital Mississippi River Basin, but required the cession of Georgia in violation of the Franco-American alliance.
|
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 Lord Shelburne, in charge of the British negotiations, agreed. Key agreements for America in obtaining peace included recognition of United States independence, that she would gain all of the area east of the Mississippi River, north of Florida, and south of Canada; the granting of fishing rights in the Grand Banks, off the coast of Newfoundland and in the Gulf of Saint Lawrence; the United States and Great Britain were to each be given perpetual access to the Mississippi River.
|
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 treaty with France. John Adams, who helped draft the treaty, claimed it represented "one of the most important political events that ever happened on the globe". Ratified respectively by Congress and Parliament, the final versions were exchanged in Paris the following spring. On 25 November, the last British troops remaining in the US were evacuated from New York to Halifax.
|
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 last uniformed British troops departed their last east coast port cities in Savannah, Charleston, and New York City, by November 25, 1783. That marked the end of British occupation in the new United States.
|
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 occurred, an effort that involved much negotiation and would take some seven months to effect.
|
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 2, 1783. Once the conclusive Treaty of Paris was signed with Britain, Washington resigned as commander-in-chief at Congress, leaving for his Army retirement at Mount Vernon. Territory
|
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 Revolutionary War. Virginia's Kentucky County counted 150 men in 1775. By 1790 fifteen years later, it numbered over 73,000 and was seeking statehood in the United States.
|
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. Though British forts on their lands had been ceded to either the French or the British prior to the creation of the United States, Natives were not referred to in the British cession to the US.
|
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 Fort Miami (Ohio). British sponsorship of local warfare on the United States continued until the Anglo-American Jay Treaty went into effect. At the same time, the Spanish also sponsored war within the US by Indian proxies in its Southwest Territory ceded by France to Britain, then Britain to the Americans.
|
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 soft power diplomatically challenged the British territorial cession west to the Mississippi and the previous northern boundaries of Spanish Florida. It imposed a high tariff on American goods, then blocked American settler access to the port of New Orleans. Spanish hard power extended war alliances and arms to Southwestern Natives to resist American settlement. A former Continental Army General, James Wilkinson settled in Kentucky County Virginia in 1784, and there he fostered settler secession from Virginia during the Spanish-allied Chickamauga Cherokee war. Beginning in 1787, he received pay as Spanish Agent 13, and subsequently expanded his efforts to persuade American settlers west of the Appalachians to secede from the United States, first in the Washington administration, and later again in the Jefferson administration.
|
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 during those years. Historian Joseph Ellis suggests that Washington's decision to have his troops inoculated against the disease was one of his most important decisions.
|
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 or disabled by the war has been estimated from 8,500 to 25,000. The French suffered 2,112 killed in combat in the United States. The Spanish lost a total of 124 killed and 247 wounded in West Florida.
|
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 Constitution, often word-for-word in places. It inspired the French, Haitian, Latin American Revolutions, and others into the modern era.
|
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 war. While many were uneasy over the contradiction of demanding liberty for some, yet denying it to others, the dependence of southern states on slave labor made abolition too great a challenge. Between 1774 and 1780, many of the states banned the importation of slaves, but the institution itself continued.
|
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 states had outlawed it. However, even many like Adams who viewed slavery as a 'foul contagion' opposed the 1790 petition as a threat to the Union. In 1808, Jefferson passed legislation banning the importation of slaves, but allowed the domestic slave trade to continue, arguing the federal government had no right to regulate individual states.
|
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." Contemporaries credited the American Enlightenment with laying the intellectual, moral and ethical foundations of the Revolution among the Founding Fathers. Founders referred to the liberalism in the philosophy of John Locke as powerful influences. Although Two Treatises of Government has long been cited as a major influence on American thinkers, historians David Lundberg and Henry F. May demonstrate that Locke's Essay Concerning Human Understanding was far more widely read than were his political Treatises. Historians since the 1960s have emphasized that the Patriot constitutional argument was made possible by the emergence of a sense of American nationalism that united all 13 colonies. In turn, that nationalism was rooted in a Republican value system that demanded consent of the governed and opposed aristocratic control. In Britain itself, republicanism was a fringe view since it challenged the aristocratic control of the British political system. Political power was not controlled by an aristocracy or nobility in the 13 colonies, and instead, the colonial political system was based on the winners of free elections, which were open to the majority of white men. In the analysis of the coming of the Revolution, historians in recent decades have mostly used one of three approaches.
|
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 into colonial cleavages.
|
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 have examined how the rising American legal profession adopted British common law to incorporate republicanism by selective revision of legal customs and by introducing more choices for courts.
|
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 war itself was ever issued. The first such stamp was the 'Liberty Bell' issue of 1926. See also 1776 in the United States: events, births, deaths, and other years
Timeline of the American Revolution
|
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 Patriots of the American Revolution
History of Poles in the United States#American Revolution
List of clergy in the American Revolution
List of Patriots (American Revolution)
Quakers in the American Revolution
Scotch-Irish Americans#American Revolution Others in the American Revolution
Nova Scotia in the American Revolution
Watauga Association
|
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 "Thirteen Colony" economy
Economic history of the US: Colonial economy to 1780
Shipbuilding in the American colonies
Slavery in the United States
|
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
United States Bicentennial
List of wars of independence Bibliographies
Bibliography of the American Revolutionary War
Bibliography of Thomas Jefferson
Bibliography of George Washington Notes Citations
Year dates enclosed in [brackets] denote year of original printing Sources Britannica.com Dictionary of American Biography Encyclopædia Britannica , p. 73
|
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 Place
Totallyhistory.com
U.S. Merchant Marine
U.S. National Archives
Valley Forge National Historic Park
Yale Law School, Massachusetts Act Bibliography A selection of works relating to the war not listed above;
|
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)
Chartrand, Rene. The French Army in the American War of Independence (1994). Short (48pp), very well illustrated descriptions.
Commager, Henry Steele and Richard B. Morris, eds. The Spirit of 'Seventy-Six': The Story of the American Revolution as told by Participants. (Indianapolis: Bobbs-Merrill, 1958). online
Conway, Stephen. The War of American Independence 1775–1783. Publisher: E. Arnold, 1995. . 280 pp.
Kwasny, Mark V. Washington's Partisan War, 1775–1783. Kent, Ohio: 1996. . Militia warfare.
Library of Congress
May, Robin. The British Army in North America 1775–1783 (1993). Short (48pp), very well illustrated descriptions.
National Institute of Health
Neimeyer, Charles Patrick. America Goes to War: A Social History of the Continental Army (1995)
Royal Navy Museum
Stoker, Donald, Kenneth J. Hagan, and Michael T. McMaster, eds. Strategy in the American War of Independence: a global approach (Routledge, 2009) excerpt.
Symonds, Craig L. A Battlefield Atlas of the American Revolution (1989), newly drawn maps emphasizing the movement of military units
U.S. Army, "The Winning of Independence, 1777–1783" American Military History Volume I, 2005.
U.S. National Park Service
Zlatich, Marko; Copeland, Peter. General Washington's Army (1): 1775–78 (1994). Short (48pp), very well illustrated descriptions.
——. General Washington's Army (2): 1779–83 (1994). Short (48pp), very well illustrated descriptions.
|
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-sourced online at Internet Archive and Hathi Trust Digital Library.
Emmerich, Adreas. The Partisan in War, a treatise on light infantry tactics written by Colonel Andreas Emmerich in 1789. External links Maps of the Revolutionary War from the United States Military Academy
|
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
Conflicts in 1777
Conflicts in 1778
Conflicts in 1779
Conflicts in 1780
Conflicts in 1781
Conflicts in 1782
Conflicts in 1783
Global conflicts
Rebellions against the British Empire
Wars between the United Kingdom and the United States
Wars of independence
|
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, algorithms can perform automated deductions (referred to as automated reasoning) and use mathematical and logical tests to divert the code through various routes (referred to as automated decision-making). Using human characteristics as descriptors of machines in metaphorical ways was already practiced by Alan Turing with terms such as "memory", "search" and "stimulus".
|
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 number of well-defined successive states, eventually producing "output" and terminating at a final ending state. The transition from one state to the next is not necessarily deterministic; some algorithms, known as randomized algorithms, incorporate random input.
|
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 numbers, and the Euclidean algorithm for finding the greatest common divisor of two numbers. Arabic mathematicians such as al-Kindi in the 9th century used cryptographic algorithms for code-breaking, based on frequency analysis.
|
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 in the House of Wisdom in Baghdad, whose name means 'the native of Khwarazm', a region that was part of Greater Iran and is now in Uzbekistan. About 825, al-Khwarizmi wrote an Arabic language treatise on the Hindu–Arabic numeral system, which was translated into Latin during the 12th century. The manuscript starts with the phrase Dixit Algorizmi ('Thus spake Al-Khwarizmi'), where "Algorizmi" was the translator's Latinization of Al-Khwarizmi's name. Al-Khwarizmi was the most widely read mathematician in Europe in the late Middle Ages, primarily through another of his books, the Algebra. In late medieval Latin, algorismus, English 'algorism', the corruption of his name, simply meant the "decimal number system". In the 15th century, under the influence of the Greek word ἀριθμός (arithmos), 'number' (cf. 'arithmetic'), the Latin word was altered to algorithmus, and the corresponding English term 'algorithm' is first attested in the 17th century; the modern sense was introduced in the 19th century.
|
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 term, but it was not until the late 19th century that "algorithm" took on the meaning that it has in modern English. Another early use of the word is from 1240, in a manual titled Carmen de Algorismo composed by Alexandre de Villedieu. It begins with: which translates to:
|
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–Kleene recursive functions 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. Informal definition
|
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 algorithm if it stops eventually—even though infinite loops may sometimes prove desirable. A prototypical example of an algorithm is the Euclidean algorithm, which is used to determine the maximum common divisor of two integers; an example (there are others) is described by the flowchart above and as an example in a later section.
|
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 equally useful, in the case of certain enumerably infinite sets: They can give explicit instructions for determining the nth member of the set, for arbitrary finite n. Such instructions are to be given quite explicitly, in a form in which they could be followed by a computing machine, or by a human who is capable of carrying out only very elementary operations on symbols.
|
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. For example, an algorithm can be an algebraic equation such as y = m + n (i.e., two arbitrary "input variables" m and n that produce an output y), but various authors' attempts to define the notion indicate that the word implies much more than this, something on the order of (for the addition example):
Precise instructions (in a language understood by "the computer") for a fast, efficient, "good" process that specifies the "moves" of "the computer" (machine or human, equipped with the necessary internally contained information and capabilities) to find, decode, and then process arbitrary input integers/symbols m and n, symbols + and = ... and "effectively" produce, in a "reasonable" time, output-integer y at a specified place and in a specified format.
|
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 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.
|
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 considered to be any sequence of operations that can be simulated by a Turing-complete system. Authors who assert this thesis include Minsky (1967), Savage (1987) and Gurevich (2000):
Minsky: "But we will also maintain, with Turing ... that any procedure which could "naturally" be called effective, can, in fact, be realized by a (simple) machine. Although this may seem extreme, the arguments ... in its favor are hard to refute".
|
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. The informal definitions of algorithms generally require that the algorithm always terminates. This requirement renders the task of deciding whether a formal procedure is an algorithm impossible in the general case—due to a major theorem of computability theory known as the halting problem.
|
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 data structures. For some of these computational processes, the algorithm must be rigorously defined: specified in the way it applies in all possible circumstances that could arise. This means that any conditional steps must be systematically dealt with, case-by-case; the criteria for each case must be clear (and computable).
|
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 of control.
|
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 of a variable. It derives from the intuition of "memory" as a scratchpad. An example of such an assignment can be found below. For some alternate conceptions of what constitutes an algorithm, see functional programming and logic programming.
|
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 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 the statements based on natural language. Programming languages are primarily intended for expressing algorithms in a form that can be executed by a computer, but are also often used as a way to define or document algorithms.
|
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 assembly code called "sets of quadruples" (see Turing machine for more).
|
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 description
"...prose used to define the way the Turing machine uses its head and the way that it stores data on its tape. At this level, we do not give details of states or transition function."
3 Formal description
Most detailed, "lowest level", gives the Turing machine's "state table".
|
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 and divide-and-conquer. Techniques for designing and implementing algorithm designs are also called algorithm design patterns, with examples including the template method pattern and the decorator pattern.
|
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 of the algorithm
Designing an algorithm
Checking the correctness of the algorithm
Analysis of algorithm
Implementation of algorithm
Program testing
Documentation preparation Computer algorithms
|
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 are adaptability of the algorithm to computers, its simplicity and elegance, etc." Chaitin: " ... a program is 'elegant,' by which I mean that it's the smallest possible program for producing the output that it does"
|
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 available to the programmer. Rogers observes that "It is ... important to distinguish between the notion of algorithm, i.e. procedure and the notion of function computable by algorithm, i.e. mapping yielded by procedure. The same function may have several different algorithms".
|
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, (ii) discrete, indistinguishable counters (iii) an agent, and (iv) a list of instructions that are effective relative to the capability of the agent.
|
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 sequence. Besides HALT, Minsky's machine includes three assignment (replacement, substitution) operations: ZERO (e.g. the contents of location replaced by 0: L ← 0), SUCCESSOR (e.g. L ← L+1), and DECREMENT (e.g. L ← L − 1). Rarely must a programmer write "code" with such a limited instruction set. But Minsky shows (as do Melzak and Lambek) that his machine is Turing complete with only four general types of instructions: conditional GOTO, unconditional GOTO, assignment/replacement/substitution, and HALT. However, a few different assignment instructions (e.g. DECREMENT, INCREMENT, and ZERO/CLEAR/EMPTY for a Minsky machine) are also required for Turing-completeness; their exact specification is somewhat up to the designer. The unconditional GOTO is a convenience; it can be constructed by initializing a dedicated location to zero e.g. the instruction " Z ← 0 "; thereafter the instruction IF Z=0 THEN GOTO xxx is unconditional.
|
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 language that the simulator/computer/computor can effectively execute. Stone gives an example of this: when computing the roots of a quadratic equation the computor must know how to take a square root. If they don't, then the algorithm, to be effective, must provide a set of rules for extracting a square root.
|
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 example, the subprogram in Euclid's algorithm to compute the remainder would execute much faster if the programmer had a "modulus" instruction available rather than just subtraction (or worse: just Minsky's "decrement").
|
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 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". Tausworthe augments the three Böhm-Jacopini canonical structures: SEQUENCE, IF-THEN-ELSE, and WHILE-DO, with two more: DO-WHILE and CASE. An additional benefit of a structured program is that it lends itself to proofs of correctness using mathematical induction.
|
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 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.
|
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.
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.
|
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]
for each item in L, do
if item > largest, then
largest ← item
return largest
|
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 described it in his Elements (c. 300 BC). It is one of the oldest algorithms in common use. It can be used to reduce fractions to their simplest form, and is a part of many other number-theoretic and cryptographic calculations.
|
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 longer length l until the remaining portion r is less than the shorter length s. In modern words, remainder r = l − q×s, q being the quotient, or remainder r is the "modulus", the integer-fractional part left over after the division.
|
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 to one another, it yields the number "1" for their common measure. So, to be precise, the following is really Nicomachus' algorithm.
|
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 location is written in lower case letter(s) and (usually) associated with the location's name. For example, location L at the start might contain the number l = 3009.
|
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 description, shown in boldface, is adapted from Knuth 1973:2–4:
|
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 discussion).
R ← S
S ← L
|
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, STOP.
|
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 "Type two integers greater than 0"
10 INPUT A,B
20 IF B=0 THEN GOTO 80
30 IF A > B THEN GOTO 60
40 LET B=B-A
50 GOTO 20
60 LET A=A-B
70 GOTO 20
80 PRINT A
90 END
How "Elegant" works: In place of an outer "Euclid loop", "Elegant" shifts back and forth between two "co-loops", an A > B loop that computes A ← A − B, and a B ≤ A loop that computes B ← B − A. This works because, when at last the minuend M is less than or equal to the subtrahend S (Difference = Minuend − Subtrahend), the minuend can become s (the new measuring length) and the subtrahend can become the new r (the length to be measured); in other words the "sense" of the subtraction reverses.
|
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 14157 and 5950.
|
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 happens if negative numbers are entered? Fractional numbers? If the input numbers, i.e. the domain of the function computed by the algorithm/program, is to include only positive integers including zero, then the failures at zero indicate that the algorithm (and the program that instantiates it) is a partial function rather than a total function. A notable failure due to exceptions is the Ariane 5 Flight 501 rocket failure (June 4, 1996).
|
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 program be the length of its correctness proof.
|
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 case: "Elegant" does two conditional tests in every subtraction loop, whereas "Inelegant" only does one. As the algorithm (usually) requires many loop-throughs, on average much time is wasted doing a "B = 0?" test that is needed only after the remainder is computed.
|
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, insight, application of inductive reasoning, etc. Observe that steps 4, 5 and 6 are repeated in steps 11, 12 and 13. Comparison with "Elegant" provides a hint that these steps, together with steps 2 and 3, can be eliminated. This reduces the number of core instructions from thirteen to eight, which makes it "more elegant" than "Elegant", at nine steps.
|
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 analysis. Algorithmic analysis
|
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 numbers would have a time requirement of 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 O(1), if the space required to store the input numbers is not counted, or O(n) if it is counted.
|
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 empirical
|
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 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.
|
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. Execution efficiency
|
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 on special properties of the problem, which are very common in practical applications. Speedups of this magnitude enable computing devices that make extensive use of image processing (like digital cameras and medical equipment) to consume less power. Classification
There are various ways to classify algorithms, each with its own merits. By implementation
One way to classify algorithms is by implementation means.
|
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 stacks 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.
Logical
An algorithm may be viewed as controlled logical deduction. This notion may be expressed as: Algorithm = logic + control. The logic component expresses the axioms that may be used in the computation and the control component determines the way in which deduction is applied to the axioms. This is the basis for the logic programming paradigm. In pure logic programming languages, the control component is fixed and algorithms are specified by supplying only the logic component. The appeal of this approach is the elegant semantics: a change in the axioms produces a well-defined change in the algorithm.
Serial, parallel or distributed
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 designed for such an environment is called a serial algorithm, as opposed to parallel algorithms or distributed algorithms. Parallel algorithms take advantage of computer architectures where several processors can work on a problem at the same time, whereas distributed algorithms utilize multiple machines connected with a computer network. Parallel or distributed algorithms divide the problem into more symmetrical or asymmetrical subproblems and collect the results back together. 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. Some problems have no parallel algorithms and are called inherently serial problems.
Deterministic or non-deterministic
Deterministic algorithms solve the problem with exact decision at every step of the algorithm whereas non-deterministic algorithms solve problems via guessing although typical guesses are made more accurate through the use of heuristics.
Exact or approximate
While many algorithms reach an exact solution, approximation algorithms 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.
Quantum algorithm
They 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.
|
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 enough to solve easily. One such example of divide and conquer is 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.
Search and enumeration
Many problems (such as playing chess) can be modeled as problems on graphs. A graph exploration algorithm specifies rules for moving around a graph and is useful for such problems. This category also includes search algorithms, branch and bound enumeration and backtracking.
Randomized algorithm
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. Whether randomized algorithms with 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:
Monte Carlo algorithms return a correct answer with high-probability. E.g. RP is the subclass of these that run in polynomial time.
Las Vegas algorithms always return the correct answer, but their running time is only probabilistically bound, e.g. ZPP.
Reduction of complexity
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 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.
Back tracking
In this approach, multiple solutions are built incrementally and abandoned when it is determined that they cannot lead to a valid full solution.
|
wikipedia
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.