# What is an Algorithm? How does it work?

#### Gauloran Hi, I decided to open a detailed topic about algorithms and I hope you like it.

Contents

1-) What is an Algorithm?
2-) Application
3-) Legal Issues
4-) Important Types of Algorithms
4.1-) Search Algorithms
4.2-) Evolutionary Algorithm
4.3-) Genetic Algorithm
4.4-) Cryptographic Algorithm
4.5-) Root Finding Algorithm
4.6-) Memory management algorithms
4.7-) Computer graphics algorithms
4. Combinational algorithms
4.9-) Graph algorithms
4.2.1-) Optimization algorithms
4.2.2-) Data compression algorithms
5-) Sorting Algorithms

What is Algorithm?

In mathematics and computer science, an algorithm is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of problems or to perform a computation. Algorithms are always unambiguous and are used as specifications for performing calculations, data processing, automated reasoning, and other tasks.

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.

The concept of algorithm has existed since antiquity. Arithmetic algorithms, such as a division algorithm, was used by ancient Babylonian mathematicians c. 2500 BC and Egyptian mathematicians c. 1550 BC. Greek mathematicians later used algorithms 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.

The word algorithm itself is derived from the 9th-century mathematician ibn Mūsā al-Khwārizmī, Latinized Algoritmi. A partial formalization of what would become 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.

Let's give an example to the computer algorithm. Let's type the algorithm that displays the average of four numbers the user has entered:

Kod:
`````` A0 -> Start
A1 -> Counter = 0 (The first number of the Counter starts with 0.)
A2 -> Number =? : T = T + Number (Enter the number. Add the number to T and show T.)
A3 -> Counter = Counter + 1 (Add 1 to the counter and show the counter.)
A4 - If the> Counter <4, go to A2. (If the counter is less than 4, go to Step 2.)
A5 -> O = T / 4 (For average, divide T value by 4)
A6 -> Show O. (Show average.)
A7 -> Stop``````

Application

Application software (app for short) is a program or group of programs designed for end users. Examples of an application include a word processor, a spreadsheet, an accounting application, a web browser, an email client, a media player, a file viewer, simulators, a console game or a photo editor. The collective noun application software refers to all applications collectively. This contrasts with system software, which is mainly involved with running the computer.

Applications may be bundled with the computer and its system software or published separately, and may be coded as proprietary, open-source or university projects. Apps built for mobile platforms are called mobile apps.

Legal Issues

Different countries have different rules for how to present and describe software in patent applications so that it is patentable. Since patents are a per country right, your best bet is to speak with a patent expert in the country where you want patent protection. In the US, the software is broadly patentable. Even business method ideas may be patentable, which is the application of known technology to a new commercial problem. There are some restrictions for software that is considered to be abstract. Consulting with a US patent agent or attorney can help you find out whether your software is patentable. The software patent is highly controversial and there are many criticized patents involving algorithms especially data compression algorithms as in Unisys' LZW patent.

Important Types of Algorithms

Search algorithms are algorithms that find the desired information according to selected features in computer science. They work on lists, text, and figures.

Two-way string-matching algorithm

In computer science, the two-way string-matching algorithm is an efficient string-searching algorithm that can be viewed as a combination of the forward-going KnuthMorrisPratt algorithm and the backward-running BoyerMoore string-search algorithm. Maxime Crochemore and Dominique Perrin invented this algorithm in 1991. The preprocessing time is linear to the needle size. It has a linear worst-case performance at 2n-m comparisons. Breslauer has two improvements with fewer comparisons: one with constant space and n+floor(1+eps/2 * (n-m)) comparisons, the other with log(m) space and n + floor((n-m)/2) comparisons.

As with KMP and BM, the algorithms utilizes shifts based on partially repeating periods in the pattern. However, it does so via partitioning (critical factorization) of the needle into two halves, so that only one value needs to be remembered from preprocessing.

The algorithm is considered fairly efficient in real-world conditions, being cache-friendly and containing operations amenable to replacement by library functions. It is selected as the glibc (and the derived newlib; str-two-way.h) and musl algorithm for the memmem and strstr family of substring functions. However, as with most advanced string-search algorithms, there tends to be a break-even point in the size of both the haystack and the needle, before which a naive quadratic (memchr-memcmp) implementation is more efficient. Glibc provides the Breslauer algorithm in both forms.

Breadth-first search (BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at the tree root (or some arbitrary node of a graph, sometimes referred to as a 'search key'), and explores all of the neighbor nodes at the present depth prior to moving on to the nodes at the next depth level.

It uses the opposite strategy as depth-first search, which instead explores the node branch as far as possible before being forced to backtrack and expand other nodes.

BFS and its application in finding connected components of graphs were invented in 1945 by Konrad Zuse, in his (rejected) Ph.D. thesis on the Plankalkül programming language, but this was not published until 1972. It was reinvented in 1959 by Edward F. Moore, who used it to find the shortest path out of a maze, and later developed by C. Y. Lee into a wire routing algorithm (published 1961).

Depth-first search (DFS)

Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible along each branch before backtracking.

A version of depth-first search was investigated in the 19th century by French mathematician Charles Pierre Trémaux as a strategy for solving mazes.

Evolutionary algorithm

In artificial intelligence (AI), an evolutionary algorithm (EA) is a subset of evolutionary computation, a generic population-based ****heuristic optimization algorithm. An EA uses mechanisms inspired by biological evolution, such as reproduction, mutation, recombination, and selection. Candidate solutions to the optimization problem play the role of individuals in a population, and the fitness function determines the quality of the solutions (see also loss function). Evolution of the population then takes place after the repeated application of the above operators.

Genetic algorithm

In computer science and operations research, a genetic algorithm (GA) is a ****heuristic inspired by the process of natural selection that belongs to the larger class of evolutionary algorithms (EA). Genetic algorithms are commonly used to generate high-quality solutions to optimization and search problems by relying on biologically inspired operators such as mutation, crossover and selection. John Holland introduced genetic algorithms in 1960 based on the concept of Darwins theory of evolution, and his student David E. Goldberg further extended GA in 1989.

Encryption algorithm

In cryptography, encryption is the process of encoding information. This process converts the original representation of the information, known as plaintext, into an alternative form known as ciphertext. Only authorized parties can decipher a ciphertext back to plaintext and access the original information. Encryption does not itself prevent interference but denies the intelligible content to a would-be interceptor. For technical reasons, an encryption scheme usually uses a pseudo-random encryption key generated by an algorithm.

Root-finding algorithms

In mathematics and computing, a root-finding algorithm is an algorithm for finding zeroes, also called "roots", of continuous functions. A zero of a function f, from the real numbers to real numbers or from the complex numbers to the complex numbers, is a number x such that f(x) = 0. As, generally, the zeroes of a function cannot be computed exactly nor expressed in closed form, root-finding algorithms provide approximations to zeroes, expressed either as floating point numbers or as small isolating intervals, or disks for complex roots (an interval or disk output being equivalent to an approximate output together with an error bound).

Sorting algorithm

In computer science, a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most frequently used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the efficiency of other algorithms (such as search and merge algorithms) that require input data to be in sorted lists. Sorting is also often useful for canonicalizing data and for producing human-readable output. More formally, the output of any sorting algorithm must satisfy two conditions:

The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order);
The output is a permutation (a reordering, yet retaining all of the original elements) of the input.

Further, the input data is often stored in an array, which allows random access, rather than a list, which only allows sequential access; though many algorithms can be applied to either type of data after suitable modification.

Sorting algorithms are often referred to as a word followed by the word "sort" and grammatically are used in English as noun phrases, for example in the sentence, "it is inefficient to use insertion sort on large lists" the phrase insertion sort refers to the insertion sort sorting algorithm.

Source: https://www.turkhackteam.org/algoritma/1068056-algoritma-nedir-ne-ise-yarar-nasil-calisir.html

Translator Gauloran

#### cassioo

##### Yeni üye Thank you just started learning programming and already understood that you need to know algorithms in order to write productive programs.

### THT SON MESAJLAR

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.