How Algorithms Remind Us of Recipes

We’ve been going on and on about the different applications of algorithms for some time now. But for new readers who stumbled upon this blog, let’s take a look on the fundamentals surrounding algorithms.

Explaining how algorithms work can be a daunting task. To simplify things, let’s simply equate algorithms to recipes. They’re almost similar, right? In the same way as to how a recipe is composed of a series of steps to reach a finished product, an algorithm also has a number of steps that needs to be followed to accomplish a task.

But an algorithm, in a sense, goes beyond the basics of a recipe. It’s more technical. It has more specifications. Recipes allot for certain allowances for the cook. You can mix new ingredients to your liking. Its instructions are far more general as well. But these could not work for algorithms. Algorithms require exact specifications in order to work well.

To help you further understand this point, let’s take a look at the different fundamental properties of algorithms.

  • A defined set of inputs

For the algorithm to work, it requires a specific set of inputs. It could be as simple as a number, a word or two or more digits. It could even be a condition like the completion of a specified task. In cases of the latter, this is commonly referred to as the precondition. It could be a clause that states the requirements of the inputs.  Oftentimes, it serves as a filter.

  • A defined set of outputs

The result is clearly defined as well. It can never be ambiguous. If the requirements are met and the proper inputs are used then, the algorithm will work, calculations will be done and the desired output will be shown.

  • Sequential

Algorithms work on a step-by-step basis. It can never jump to the next step if you haven’t finished the first step, unless in instances when you specified such action.

  • Accuracy

If algorithms are properly written, they will always provide the desired result. It works that way 100% of the time.

  • Runs over a finite period of time

Algorithms are posed to terminate once the series of steps are completed and the output has been delivered. There’s no such thing as algorithms running forever. There will always be an end to it.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s