Location>code7788 >text

What is an algorithm? Everything is an algorithm.

Popularity:74 ℃/2024-08-29 08:07:54

If someone asks me what an algorithm is? I'll just say this: an algorithm is an optimal solution path for a class of problems.

1. Algorithmic concepts in the computer field

Algorithms have always been a very important concept in the field of computers, possessing a very high status, and are examined with great fervor by various companies.

We only hear about the concept of algorithms in the fields of math, computers, and artificial intelligence, plus no one seems to be able to articulate the concept of algorithms. So, when they hear about algorithms, many people think it's a high level concept.

In computer science, an algorithm is a defined finite number of steps or sequences in which a computer can carry out its instructions, often used in computation, data processing, and automated reasoning.

Simply put, an algorithm is a well-defined collection of steps to solve a specific problem or perform a specific task. Or an algorithm is a problem-solving methodology that progressively reaches a goal through a series of steps.

In programming, algorithms are used to process data, perform calculations, automate reasoning and make decisions.

There are many common public class algorithms that we use, such as:

  • sorting algorithm: e.g., Quick Sort, Bubble Sort, etc., are used to put data in a particular order.
  • search algorithm: e.g. binary lookup, used to find a specific element in a dataset.
  • encryption algorithm: e.g. AES, RSA for data encryption and decryption.
  • path planning algorithm: e.g. Dijkstra's algorithm for finding the shortest path.

2. Do algorithms exist only in the computer field?

We basically only hear the concept of algorithms in the field of mathematics and computers, and when we think of "algorithms", the first thing that comes to mind is complex mathematical formulas or computer programs. Do algorithms exist in other fields?

My point is that algorithms don't just exist in tech, they exist in all fields.

Why? Because an algorithm is a general concept, it is a way of thinking about problem solving, it helps us to clarify our thoughts and find the optimal solution.

Algorithms to put it bluntly:Optimal solution paths for a class of problems

Each industry has a variety of problems, each problem has a corresponding solution and steps. There is a problem, there is a precipitated solution path, this is not the algorithm.

So algorithms exist in every industry. Let's not think so highly of algorithms.

3. Algorithms in life

For example, algorithms are ubiquitous in everyday life, whether it's a farmer sowing seeds in a field, an architect designing a building, or even when we're solving life's problems.

Algorithms for peasant farming: The process for a farmer to grow good wheat is an algorithm. First of all, you need to choose the right seed, which is the input; then, you have to decide when to sow according to the weather, soil and season, which is equivalent to the judgment condition; finally, after a series of steps such as fertilizer, watering, weeding, etc., the farmer harvests the grain. This is a complete algorithmic process.

Architect's Algorithm: An architect designing a solid house is also executing a set of algorithms. From choosing building materials, to planning the structure, to the layout of each room, every step serves the end goal.

Algorithms in everyday life: Even the process of getting out of bed in your morning can be viewed as an algorithm. You might mentally comb through the steps: get up, brush your teeth, wash your face, eat breakfast, leave the house. These seemingly simple steps have an underlying logical sequence behind them that ensures you can start your day smoothly.

Algorithms for society: In society, rules and laws are also algorithms. They help us solve various social problems and maintain order. For example, traffic rules are a set of algorithms to avoid chaos and accidents; the education system is an algorithm to cultivate talents.

Programmer's algorithm: Two notes on algorithms for the programming domain:

  • For programming, writing efficient code is executing algorithms. From requirements analysis to design to coding and testing, every step is purposeful and directed.
  • Why don't we normally mention the word "algorithm"? Because regular coding is of low complexity, and in the minds of programmers, low-complexity processes and steps are not enough to be called "algorithms". But in reality, simple processes and steps are also algorithms.

4. Completion

An algorithm is an optimal solution path for a class of problems, and it exists in all walks of life, everywhere.

The end of this article! Welcome to pay attention to, add V (ylxiao) exchange, the whole network can be searched (programmers half a cigarette)

Link to original article:/s/s7pS_HUKjmfb-dNnHOyuBQ