An algorithm is a strictly defined finite sequence of well-defined statements (often called instructions or commands) that provides the solution to a problem or to a specific class of problems for any acceptable set of input values (if there are any inputs). In other words, an algorithm is a step-by-step procedure to solve a given problem. The term “finite” means that the algorithm should reach an end point and cannot run forever.

You can find algorithms everywhere in your real life, not just in computer science. For example, the process for preparing toast or a cup of tea can be expressed as an algorithm. Certain steps, in a certain order, must be followed in order to achieve your goal.