What is an Algorithm?
Let’s assume you’re frying chicken. You will need to defrost the chicken, wash them with warm water, cover with breading, fry them… and magically, you end up with a crispy, golden brown plate of chicken.
An algorithm is exactly that, a set of instructions (defrost the chicken, wash…) to produce a desired output, which in this case, is a crispy, golden brown plate of chicken. Typically used in the context of computer science and mathematics, most algorithms are designed to calculate the value of a function, process data, or even automate decision-making processes.
However, while algorithms are designed to automate and create, in a utilitarian sense, useful tasks and outputs, not all algorithms are deemed of any use. To create an algorithm worth using, your algorithm should be a good algorithm.
What makes an algorithm good?
A good algorithm is very much similar to a good recipe for fried chicken. Not all recipes are deemed good, and some, while still resulting in a very solid plate of golden brown fried chicken, might not taste up to par. Like creating the perfect fried chicken recipe, to design a good algorithm, we must follow the following criteria.
- Clear and Unambiguous: Each step in the algorithm must be clear and not open to multiple interpretations.
- Effective: The algorithm should effectively solve the problem it’s designed for. In our chicken frying example, the algorithm should result in a delicious, crispy chicken if followed correctly.
- Efficient: Efficiency refers to how well the algorithm optimizes resources, such as time and memory in computing, or ingredients and cooking time in a recipe. An efficient algorithm achieves its goal without unnecessary steps or resource waste.
- Finite: A good algorithm has a finite number of steps. It doesn’t go on indefinitely but concludes after a certain number of steps.
0%
CompletedYou have 20 sections remaining on this learning path.