Minimum Value Algorithm

What Is a Program?

A C++ program, as any other computer program, is a detailed plan for carrying out an activity called a computational process. Finding the smallest number in a given sequence of numbers is one example of a computational process. This process implements an idea called the minimum value algorithm.

These computational processes are the sorts of things you do on an everyday basis. The process of multiplying two numbers by hand is a typical example of a computational process. As you know, there is a method behind this process - something that you learned through a lot of practice in the primary school. The method that you now have in your head is an algorithm.

Algorithms can be communicated in two ways: either by example or by description. If you wanted to teach your little brother how to multiply two numbers, you could just carry out in front of him the multiplication process on many different pairs of numbers and hope that he will pick up the method by intuition. Given sufficient time and examples, he might eventually do this, but there is a better way. You could systematically describe to him the multiplication process, showing in detail how it really works and how the results of each step carry on to the next. Doing that, you would actually present him with an algorithm for multiplying two numbers. To go a step further, you could write down such a description of this algorithm on a piece of paper.

There is a problem though, with expressing algorithms in plain English. Our natural languages are, in many ways, not best suited for describing algorithms. Descriptions of algorithms in natural languages often end up being convoluted and ambiguous.

For this very reason, programming languages were carefully designed not to suffer from those problems. In this book, almost all algorithms that we shall write will be stated in the C++ language.

Finally, what is a computer program? A computer program is a description of a computational process written down in a programming language. An algorithm is an idea behind a particular computational process. An algorithm can also be described as a method for obtaining a concrete solution of a particular problem for any valid input data given.