Algoritma: Béda antarrépisi

Ti Wikipédia Sunda, énsiklopédi bébas
Konten dihapus Konten ditambahkan
TjBot (obrolan | kontribusi)
m r2.7.2) (bot Nambih: hy:Ալգորիթմ
Tidak ada ringkasan suntingan
Baris ka-3: Baris ka-3:
'''Algoritma''' nyaéta susunan paréntah, nu jumlahna kawates, pikeun ngolah sababaraha paréntah nu, sakumpulan data asupanana, bakal ngahasilkeun sarupaning bentuk ahir nu bisa dipikawanoh; sabalikna ti [[heuristik]]. Konsép algoritma mindeng digambarkeun ku conto hiji [[resép]], sanajan loba algoritma kacida ruwetna; algoritma sering miboga léngkah-léngkah anu malikan ([[iterasi]]) atawa merlukeun kaputusan (saperti [[logika Boolean|logika]] atawa [[kahenteusaruaan|perbandingan]]) nepi ka tugas diréngsékeunnana.
'''Algoritma''' nyaéta susunan paréntah, nu jumlahna kawates, pikeun ngolah sababaraha paréntah nu, sakumpulan data asupanana, bakal ngahasilkeun sarupaning bentuk ahir nu bisa dipikawanoh; sabalikna ti [[heuristik]]. Konsép algoritma mindeng digambarkeun ku conto hiji [[resép]], sanajan loba algoritma kacida ruwetna; algoritma sering miboga léngkah-léngkah anu malikan ([[iterasi]]) atawa merlukeun kaputusan (saperti [[logika Boolean|logika]] atawa [[kahenteusaruaan|perbandingan]]) nepi ka tugas diréngsékeunnana.
{{Tarjamahkeun|Inggris}}
{{Tarjamahkeun|Inggris}}
Different algorithms may complete the same task with a different set of instructions in more or less time, space, or effort than others. For example, given two different recipes for making potato salad, one may have ''peel the potato'' before ''boil the potato'' while the other presents the steps in the reverse order, yet they both call for these steps to be repeated for all potatoes and end when the potato salad is ready to be eaten. <!-- poor example .. who would boil each potato separately? and making a salad in general requires no cooking ... -->
sababaraha alogaritma bisa anggeus ku pagawean nu sarua make susunan parentah nu beda in more or less time, space, or effort than others. For example, given two different recipes for making potato salad, one may have ''peel the potato'' before ''boil the potato'' while the other presents the steps in the reverse order, yet they both call for these steps to be repeated for all potatoes and end when the potato salad is ready to be eaten. <!-- poor example .. who would boil each potato separately? and making a salad in general requires no cooking ... -->


Correctly performing an algorithm will not solve a problem if the algorithm is flawed or not appropriate to the problem. For example, performing the potato salad algorithm will fail if there are no potatoes present, even if all the motions of preparing the salad are performed as if the potatoes were there.
Correctly performing an algorithm will not solve a problem if the algorithm is flawed or not appropriate to the problem. For example, performing the potato salad algorithm will fail if there are no potatoes present, even if all the motions of preparing the salad are performed as if the potatoes were there.

Révisi nurutkeun 12 Juli 2012 03.55

Diagram alir mindeng dipaké pikeun ngagambarkeun algoritma.

Algoritma nyaéta susunan paréntah, nu jumlahna kawates, pikeun ngolah sababaraha paréntah nu, sakumpulan data asupanana, bakal ngahasilkeun sarupaning bentuk ahir nu bisa dipikawanoh; sabalikna ti heuristik. Konsép algoritma mindeng digambarkeun ku conto hiji resép, sanajan loba algoritma kacida ruwetna; algoritma sering miboga léngkah-léngkah anu malikan (iterasi) atawa merlukeun kaputusan (saperti logika atawa perbandingan) nepi ka tugas diréngsékeunnana.

Artikel ieu keur dikeureuyeuh, ditarjamahkeun tina basa Inggris.
Bantuanna didagoan pikeun narjamahkeun.

sababaraha alogaritma bisa anggeus ku pagawean nu sarua make susunan parentah nu beda in more or less time, space, or effort than others. For example, given two different recipes for making potato salad, one may have peel the potato before boil the potato while the other presents the steps in the reverse order, yet they both call for these steps to be repeated for all potatoes and end when the potato salad is ready to be eaten.

Correctly performing an algorithm will not solve a problem if the algorithm is flawed or not appropriate to the problem. For example, performing the potato salad algorithm will fail if there are no potatoes present, even if all the motions of preparing the salad are performed as if the potatoes were there.

In some countries, such as the USA, some algorithms can effectively be patented if an embodiment is possible (for example, a multiplication algorithm embodied in the arithmetic unit of a microprocessor).

Algoritma nu dirumuskeun

Algorithms are essential to the way computers process information, because a computer program is essentially an algorithm that tells the computer what specific steps to perform (in what specific order) in order to carry out a specified task, such as calculating employees’ paychecks or printing students’ report cards. Thus, an algorithm can be considered to be any sequence of operations which can be performed by a Turing-complete system.

Typically, when an algorithm is associated with processing information, data is read from an input source or device, written to an output sink or device, and/or stored for further use. Stored data is regarded as part of the internal state of the entity performing the algorithm.

For any such computational process, the algorithm must be rigorously defined: specified in the way it applies in all possible circumstances that could arise. That is, any conditional steps must be systematically dealt with, case-by-case; the criteria for each case must be clear (and computable).

Because an algorithm is a precise list of precise steps, the order of computation will almost always be critical to the functioning of the algorithm. Instructions are usually assumed to be listed explicitly, and are described as starting 'from the top' and going 'down to the bottom', an idea that is described more formally by flow of control.

So far, this discussion of the formalisation of an algorithm has assumed the premises of imperative programming. This is the most common conception, and it attempts to describe a task in discrete, 'mechanical' means. Unique to this conception of formalized algorithms is the assignment operation, setting the value of a variable. It derives from the intuition of 'memory' as a scratchpad. There is an example below of such an assignment.

See functional programming and logic programming for alternate conceptions of what constitutes an algorithm.

Ngalarapkeun algoritma

An algorithm is a method or procedure for carrying out a task (such as solving a problem in mathematics, finding the freshest produce in a supermarket, or manipulating information in general).

Algorithms are sometimes implemented as computer programs but are more often implemented by other means, such as in a biological neural network (for example, the human brain implementing arithmetic or an insect relocating food), or in electric circuits or in a mechanical device.

The analysis and study of algorithms is one discipline of computer science, and is often practiced abstractly (without the use of a specific programming language or other implementation). In this sense, it resembles other mathematical disciplines in that the analysis focuses on the underlying principles of the algorithm, and not on any particular implementation. One way to embody (or sometimes codify) an algorithm is the writing of pseudocode.

Some writers restrict the definition of algorithm to procedures that eventually finish. Others include procedures that could run forever without stopping, arguing that some entity may be required to carry out such permanent tasks. In the latter case, success can no longer be defined in terms of halting with a meaningful output. Instead, terms of success that allow for unbounded output sequences must be defined. For example, an algorithm that verifies if there are more zeros than ones in an infinite random binary sequence must run forever to be effective. If it is implemented correctly, however, the algorithm's output will be useful: for as long as it examines the sequence, the algorithm will give a positive response while the number of examined zeros outnumber the ones, and a negative response otherwise. Success for this algorithm could then be defined as eventually outputting only positive responses if there are actually more zeros than ones in the sequence, and in any other case outputting any mixture of positive and negative responses.

Conto

Di dieu aya conto sederhana dina algoritma.

Bayangkeun anjeun mibanda wilangan random dina daptar nu teu kasortir. Tujuan ahirna keur manggihkeun wilangan panggedena tina eta daptar. Lengkah mimiti nyaeta kudu nempo kana sakabeh nilai nu aya dina deret. Lengkah saterusna nyaeta nempo kana eta nilai ngan sakali. Asupkeun kana itungan, algoritma basajan ngeunaan hal eta saperti di handap ieu:

  1. Pretend the first number in the list is the largest number.
  2. Look at the next number, and compare it with this largest number.
  3. Only if this next number is larger, then keep that as the new largest number.
  4. Repeat steps 2 and 3 until you have gone through the whole list.

And here is a more formal coding of the algorithm in a pseudocode that is similar to most programming languages:

Given: a list "List" 

largest = List[1]
counter = 2
while counter <= length(List):
    if List[counter] > largest:
        largest = List[counter]
    counter = counter + 1
print largest

Notes on notation:

  • = as used here indicates assignment. That is, the value on the right-hand side of the expression is assigned to the container (or variable) on the left-hand side of the expression.
  • List[counter] as used here indicates the counterth element of the list. For example: if the value of counter is 5, then List[counter] refers to the 5th element of the list.
  • <= as used here indicates 'less than or equal to'

Note also the algorithm assumes that the list contains at least one number. It will fail when presented an empty list. Most algorithms have similar assumptions on their inputs, called pre-conditions.

As it happens, most people who implement algorithms want to know how much of a particular resource (such as time or storage) a given algorithm requires. Methods have been developed for the analysis of algorithms to obtain such quantitative answers; for example, the algorithm above has a time requirement of O(n), using the big O notation with n representing for the length of the list.

Sajarah

A tribute to the originator and namesake of algorithms

Kecap algoritma comes ultimately from the name of the 9th-century mathematician Abu Abdullah Muhammad bin Musa al-Khwarizmi. The word algorism originally referred only to the rules of performing arithmetic using Arabic numerals but evolved into algorithm by the 18th century. The word has now evolved to include all definite procedures for solving problems or performing tasks.

The first case of an algorithm written for a computer was Ada Byron's notes on the analytical engine written in 1842, for which she is considered by many to be the world's first programmer. However, since Charles Babbage never completed his analytical engine the algorithm was never implemented on it.

The lack of mathematical rigor in the "well-defined procedure" definition of algorithms posed some difficulties for mathematicians and logicians of the 19th and early 20th centuries. This problem was largely solved with the description of the Turing machine, an abstract model of a computer formulated by Alan Turing, and the demonstration that every method yet found for describing "well-defined procedures" advanced by other mathematicians could be emulated on a Turing machine (a statement known as the Church-Turing thesis).

Nowadays, a formal criterion for an algorithm is that it is a procedure that can be implemented on a completely-specified Turing machine or one of the equivalent formalisms. Turing's initial interest was in the halting problem: deciding when an algorithm describes a terminating procedure. In practical terms computational complexity theory matters more: it includes the puzzling problem of the algorithms called NP-complete, which are generally presumed to take more than polynomial time.

Kelas algoritma

Aya sababaraha cara keur nyieun kelas algoritma, and the merits of each classification have been the subject of ongoing debate.

One way of classifying algorithms is by their design methodology or paradigm. There is a certain number of paradigms, each different from the other. Furthermore, each of these categories will include many different types of algorithm. Some commonly found paradigms include:

  • Divide and conquer. A divide-and-conquer algorithm 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 be directly expressible in the programming language employed (what is 'direct' is often discretionary).
  • Dynamic programming. When a problem shows optimal substructure, i.e when the optimal solution to a problem consists of optimal solutions to subproblems (for instance the shortest path between two vertices on a weighted graph consists of the shortest path between all the vertices in between.) You solve such a problem bottom-up by solving the simplest problems first and then procceding to increasingly difficult problems until you have solved the original problem. This is called a dynamic programming algorithm.
  • The greedy method. A greedy algorithm is similar to a dynamic programming algorithm, but the difference is that at each stage you don't have to have the solutions to the subproblems, you can make a "greedy" choice of what looks best for the moment.
  • Linear programming. When you solve a problem using linear programming you put the program into a number of linear inequalities and then try to maximize (or minimize) the inputs. Many problems (such as the maximum flow for directed graphs) can be stated in a linear programming way, and then be solved by a 'generic' algorithm such as the Simplex algorithm.
  • Search and enumeration. Many problems (such as playing chess) can be modelled 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 the search algorithms and backtracking.
  • The probabilistic and heuristic paradigm. Algorithms belonging to this class fit the definition of an algorithm more loosely. Probabilistic algorithms are those that make some choices randomly (or pseudo-randomly); for some problems, it can in fact be proved that the fastest solutions must involve some randomness. Genetic algorithms attempt to find solutions to problems by mimicking biological evolutionary processes, with a cycle of random mutations yielding successive generations of 'solutions'. Thus, they emulate reproduction and "survival of the fittest". In genetic programming, this approach is extended to algorithms, by regarding the algorithm itself as a 'solution' to a problem. Also there are heuristic algorithms, whose general purpose is not to find a final solution, but an approximate solution where the time or resources to find a perfect solution are not practical. An example of this would be simulated annealing algorithms, a class of heuristic probabilistic algorithms that vary the solution of a problem by a random amount. The name 'simulated annealing' alludes to the metallurgic term meaning the heating and cooling of metal to achieve freedom from defects. The purpose of the random variance is to find close to globally optimal solutions rather than simply locally optimal ones, the idea being that the random element will be decreased as the algorithm settles down to a solution.

Another way to classify algorithms is by implementation. A recursive algorithm is one that invokes (makes reference to) itself repeatedly until a certain condition matches, which is a method common to functional programming. 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, which take advantage of computer architectures where several processors can work on a problem at the same time. The various heuristic algorithm would probably also fall into this category, as their name (e.g. a genetic algorithm) describes its implementation.

A list of algorithms discussed in Wikipedia is available.

Tempo ogé

Sumber séjén

Tumbu kaluar

Citakan:Link FA