World's most popular travel blog for travel bloggers.

[Solved]: Difference between algorithm and procedure

, , No Comments
Problem Detail: 

I came to know that the important difference between algorithm and procedure is that the algorithm halts and procedure doesn't halts(stops). But i am not able to understand the concept. Please can any one explain with the example?

Asked By : Santosh Hegde

Answered By : Anton Trunov

Let me cite the classic -- D.E. Knuth's "The Art of Computer Programming", 3ed (1997).

Some terminology first.

The modern meaning for algorithm is quite similar to that of recipe, process, method, technique, procedure, routine, rigmarole, except that the word "algorithm" connotes something just a little different.

Note: the bold face is mine. Then Knuth goes on:

A procedure that has all of the characteristics of an algorithm except that it possibly lacks finiteness may be called a computational method.

It turns out that one of the earliest examples of a computational method belongs to Euclid:

Euclid originally presented not only algorithm for the greatest common divisor of numbers, but also a very similar geometrical construction for the "greatest common measure" of the lengths of two line segments; this is a computational method that does not terminate if the given lengths are incommensurable. Another example of a nonterminating computational method is a reactive process, which continually interacts with its environment.

It seems that by the second case Knuth meant operating systems, web-servers and so on, i.e. the programs that are supposed to run "forever", but do something useful along the way.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/56399

0 comments:

Post a Comment

Let us know your responses and feedback