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 ...

Get Java and Algorithmic Thinking for the Complete Beginner now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.