thumb|Flowchart of using successive subtractions to find the greatest common divisor of number r and s|alt=In a loop, subtract the larger number against the smaller number. Halt the loop when the subtraction will make a number negative. Assess two numbers, whether one of them is equal to zero or not. If yes, take the other number as the greatest common divisor. If no, put the two numbers in the subtraction loop again. In mathematics and computer science, an algorithm () is a finite sequence of mathematically rigorous instructions, typically used to solve a class of specific problems or to perf
An algorithm is a finite sequence of mathematically rigorous instructions designed to solve a specific problem or perform a particular task. Algorithms matter because they provide step-by-step procedures that can be reliably followed to achieve consistent results, as illustrated by the example of using repeated subtraction to find the greatest common divisor of two numbers.
AI-generated from the Wikipedia summary — may contain errors.
thumb|Flowchart of using successive subtractions to find the greatest common divisor of number r and s|alt=In a loop, subtract the larger number against the smaller number. Halt the loop when the subtraction will make a number negative. Assess two numbers, whether one of them is equal to zero or not. If yes, take the other number as the greatest common divisor. If no, put the two numbers in the subtraction loop again. In mathematics and computer science, an algorithm () is a finite sequence of mathematically rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing calculations and data processing. More advanced algorithms can use conditionals to divert the code execution through various routes (referred to as automated decision-making) and deduce valid inferences (referred to as automated reasoning).
In contrast, a heuristic is an approach to solving problems without well-defined correct or optimal results. For example, although social media recommender systems are commonly called "algorithms", they actually rely on heuristics as there is no truly "correct" recommendation.
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).