# Programming Algorithms: Definition, Functions, Examples

Posted on

The majority of us are not familiar with the word algorithm and assume the meaning of the word is related to programming languages, mathematics, or computer science and contains a set of numbers.

The things mentioned above are true. There is a close relationship between algorithms and calculations, but on this occasion we will discuss more deeply what algorithms are in the programming world.

In general, the algorithm itself contains the steps in solving the problem.

Algorithms play with logic. Well, this logic is certainly closely related to programming science.

If there is no knowledge of algorithms, a programmer will usually find it difficult to do his job.

Because, basically the most important thing for a programmer is to understand the logic of the system he is going to make first before making the program itself.

Programming algorithm is the main step in creating a program in a computer.

Although there is a close relationship between mathematical calculations, in fact programming is not only about difficult calculations.

So, what exactly is an algorithm in programming? Let’s see the points and explanations from us below.

## Definition of Algorithm

Launching from the Educationpedia site, an algorithm is a flow or sequence used in calculations to solve problems systematically.

In the field of programming, programming algorithms are likened to logic in a determination of the program to be worked on.

Another idea says the definition of an algorithm is a series of methods that must be followed in calculations or other problem solving operations, especially on computers.

It can be said, all logical structures that are arranged according to a special systematic and used to solve a problem can be solved by algorithms.

As a small example, you must have read food recipes, right?

Usually the recipe writer records the required ingredients along with a series of steps to make the food. Well, this is one example of an algorithm in the real world.

Meanwhile, if it is converted to computer language, the recipe means the procedure, the ingredients are the input, and the food results from the recipe are the output.

Programming algorithms describe how to do something and then your computer will do it exactly the same way every time.

Determination of algorithms in programming is a basic thing that must be known and is the first step in programming.

The way of presentation can also be grouped into two forms, namely images and writing.

Well, it all depends on the hands of the programmer as well. In the presentation in the form of writing, usually using pseudocode, unlike the presentation in the form of images, a flowchart diagram is usually made.

The difficult thing and becomes a challenge is to apply the specified algorithm into a script or code that is neat and can run as desired.

## Algorithm Function

After fully understanding the meaning of the algorithm, we will move on to its function, this is also an important thing and you must know.

In principle, the main function of the algorithm is to solve a problem.

Apart from that, there are five algorithm functions in total. What are those?

• Can be used repeatedly, this one function provides the advantage of minimizing repetitive program writing. In other words, you don’t have to bother writing the same program over and over again.
• Minimize complex problems in high-level calculations. Because using calculations often programs that are made do not run properly because of errors.
• Able to simplify the program, meaning that if there is a large program it can be a simple program. It can also streamline users. In addition, there are two approaches that programming algorithms have, namely top-down and divide and conquer
• Fix errors easily and quickly. This means that in making programs there will always be errors, and this is very natural.
• Makes it easier to search and find errors in programs on your computer. Because the algorithm has a clear flow, it is very easy to find errors in programming.

## How the Algorithm Works

So, then how does it work? It’s simple. How programming algorithms work is a description of a process to do something that is arranged in a series of actions.

Simply put, the working principle of programming algorithms is divided into three, namely input, process and output.

Let’s take a simple example, such as boiling water for example. First we define the input and output.

In accordance with the process of boiling water, the input is raw water and the output is boiled water. So, the programming algorithm structure is as follows:

• Take the pot
• Fill with water
• Keep it on the stove
• Turn on the fire from the stove
• Wait until the water boils
• The water is cooked

## Example of Programming Algorithm

At the end of this section we will list some examples of programming algorithms that you can use for reference.

In fact, many algorithms have been created, the work which is quite time consuming is to determine which algorithms are important.

However, there are 32 algorithms commonly used in the computer world by IT scientists. From the 32, we take 10 main examples to add to your insight, here are some of them:

### 1. Binary Search

One technique for finding special values ​​in a linear array is to exclude half the data from each step.

### 2. Beam Search

The beam search is the one that optimizes the first best search. Like the main best search, this search requires a heuristic function to evaluate the nodes being examined.

### 3. Branch and Bound

An algorithm method that is commonly used to find the optimal solution of various optimization problems. Especially on discrete and combination optimization problems.

### 4. Data Compression

Source coding or data compression is the encoding of information using fewer bits than the uncoded representation which must use a more specific encoding scheme.

### 5. Dynamic Programming

The method cuts the runtime of the algorithm which shows the overlapping sub-problems and the optimal substructure.

### 6. Hashing

A function that summarizes or identifies data probabilistically.

This means that one person applies a mathematical formula to the data, and then generates a string that is likely to be unique for the generated data.

The previous string is much shorter than the original data. However, these data can be used for identification.

### 7. Metode Newton

Newton’s method is an efficient algorithm in finding the zeroth approximation of a real-valued function.

Newton’s method is also one of the known algorithms for finding the roots of equations in one or more dimensions.

It can also be used to find local maximums and local minima functions

### 8. Maximum Flow

The maximum flow problem is to find the law through the maximum flow path. Sometimes it is also defined as determining the value of the intended stream.

Then, this problem can be seen as a special case of a more complex flow path problem.

Maximum flow is also related to the cut in the network by the Max-flow Min-cut theory. The Ford-Fulkerson algorithm calculates the maximum flow in the flow network.

### 9.Karatsuba Multiplication

For systems that must multiply numbers in the range of several thousand digits such as computer algebra systems and bignum libraries, long multiplication is considered too slow. This system uses karatsuba multiplication.

### 10.Q-Learning

Q-learning is a reinforcement learning technique that works by studying the function of the value of the action that shares the utility expected to capture the action in a particular situation.

Apart from the things mentioned above, it also aims to follow the policies that follow.

The drawback of Q-Learning lies in its ability to compare expected utility and without the need for an environmental model. 