Should every algorithm be finite?

Question:

Must every algorithm always end after a finite number of steps?

It seems trivial but I ask why this generated another question that can be exposed in the following example:

enquanto (VERDADE){
         ouvir_ligações_porta_8080
    }

Is the above example an algorithm or not?

Answer:

This is an algorithm, of course. And the algorithm doesn't necessarily have to be finite. It is desirable but not mandatory. When this occurs it is called computational method, as stated in the book The Art of Computer Programming , where it is defined that one of the characteristics of the algorithm is finitude. There is an exception for this case since there are situations where only an intervention external to the algorithm is expected to finish it. This case is called a reactive process (also taken from the same book).

From the comments we conclude that the more correct term is that it is a computational method and not an algorithm. At least formally speaking. Not that anyone will have the wrong understanding of calling this an algorithm. Apparently, academically the field of computing considers as an essential condition to call something an algorithm, among other characteristics, that it be finite.

If you want to use the terms academically, it is better to say that there is a computational method there. If you want to express something that everyone understands, you can call it an algorithm at will, no one will fight you, everyone will understand and that's what matters.

Scroll to Top