An algorithm is a step-by-step procedure for solving a problem in the most efficient way. It’s like a recipe that tells you how to make something delicious.
An algorithm is a method for solving a problem that satisfies the following criteria. The name of the mathematician Muhammed ibn-Musa Al-Khowarizmi was derived from it, as an algorithm is a solution to a problem that fulfills the following criteria.
An example of an algorithm would be one for baking bread, which might require mixing flour with water, yeast, and salt; kneading it until it becomes smooth; letting the dough rise twice before shaping it into loaves, and putting them in pans to bake on low heat.
The ingredients are clear, precise instructions are given about what order all of the steps should be done in, and there is no guesswork involved. You just have to follow the recipe exactly as written!
A computer program can also contain algorithms because computer programs are essentially just sets of instructions that tell computers what to do in order to solve a particular problem.
An algorithm takes inputs (like the ingredients you add to bread), performs some kind of calculation, and produces an output (the finished bread).