Chapter 4
Introduction to Basic Algorithmic Concepts
4.1 What is an Algorithm?
In technical terms, an algorithm[1] 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 must reach an end point and cannot run forever.
You can find algorithms everywhere in your real life, not just in computer science. For instance, the process of preparing toast or a cup of tea can be expressed as an algorithm. Certain steps, in a particular order, must be followed to achieve your goal.
4.2 The Algorithm for Making a Cup of Tea
The following is an algorithm for making a cup of tea.