An algorithm is just a step-by-step process to solve a problem. Think of it like a recipe: follow the instructions, and you get a result. But how that “recipe” is used can differ depending on the subject—math or computer science.
In Math: Solving with Logic
In mathematics, an algorithm is usually a method to solve a numerical or logical problem. For example, the process for dividing two numbers, finding the greatest common divisor, or solving an equation is a mathematical algorithm.
Here, algorithms are more abstract. They often focus on what steps should be done, not necessarily how efficiently they’re done or how they’d be implemented on a machine.
Example:
To find the GCD (Greatest Common Divisor) of two numbers:
- Divide the larger number by the smaller one.
- Take the remainder and repeat the process.
- When the remainder is zero, the last non-zero remainder is the GCD.
This is a classic math algorithm.
In Computer Science: Solving with Code
In computer science, algorithms are used to solve problems using computers. These algorithms not only give a solution but also consider how efficiently it runs—how much time and memory it takes.
Computer science algorithms are written in programming languages and designed to be executed by a machine. They must be precise and optimized.
Example:
A sorting algorithm (like Bubble Sort or Merge Sort) is a computer science algorithm that arranges items in order. It’s all about performance and execution.
In Short:
- Math algorithms focus on correct steps and logical reasoning.
- Computer science algorithms focus on efficiency, scalability, and implementation in code.
Both are powerful tools—one for the chalkboard, the other for your computer!

Leave a comment