This commit is contained in:
Miloslav Ciz 2022-06-29 20:56:10 +02:00
parent c856794e38
commit eca7446b98
8 changed files with 279 additions and 40 deletions

View file

@ -1,6 +1,8 @@
# Algorithm
Algorithm is an exact description of how to solve a problem. Algorithms are basically what [programming](programming.md) is all about: we tell computers, in very exact ways (with [programming languages](programming_language.md)), how to solve problems -- we write algorithms. But algorithms don't have to be just computer programs, they are simply instruction for solving problems. (Cooking recipes are sometimes given as an example of a non-computer algorithm. You may write an algorithm for how to survive in a jungle, but it has to be **exact**; if there is an ambiguity or incompleteness, it is not an algorithm.)
Algorithm is an exact description of how to solve a problem. Algorithms are basically what [programming](programming.md) is all about: we tell computers, in very exact ways (with [programming languages](programming_language.md)), how to solve problems -- we write algorithms. But algorithms don't have to be just computer programs, they are simply instruction for solving problems.
Cooking recipes are sometimes given as an example of a non-computer algorithm. The so called wall-follower is a simple algorithm to get out of any maze: you just pick either a left-hand or right-hand wall and then keep following it. You may write a crazy algorithm for how to survive in a jungle, but it has to be **exact**; if there is any ambiguity, it is not considered an algorithm.
Interesting fact: contrary to intuition there are problems that are mathematically proven to be unsolvable by any algorithm, see [undecidability](undecidability.md), but for most practically encountered problems we can write an algorithm (though for some problems even our best algorithms can be unusably slow).