Algorithm
In computer science, an Algorithm is a set of steps for a computer program to finish a task. Broadly, an Algorithm is simply a set of steps to accomplish a task.
What makes a good algorithm?
- It solves a problem
- It does so efficiently
Example
E.g. A mob in Minecraft finding the best way to get to a player without causing too much lag or taking too long.
Sometimes we can let an algorithm not give us the perfect answer for pragmatic purposes of time, since making an algorithm 100% may make it take way longer than reasonably necessary.
Example
For example, finding the best route for a vehicle on a map may be possible given enough time, but simply finding one that is quicker than most will suffice most circumstances and not be too different from the best.
Asymptotic Analysis
How do me measure the efficiency of an Algorithm? Computer scientists use a mechanism called Asymptotic Analysis. It allows programs to be compared independently from the programming language or hardware used, so it’s possible to remove the bias or error from comparing it to other algorithms.