views:

626

answers:

8

How do you differentiate between an algorithm and a method? Why dont we call Newton's Method or Ford-Faulkerson method Algorithms? What are a properties of a good algorithm and what qualifies a method as an algorithm?

+5  A: 

There is no technical difference between the term "method" as in "Newton's method" and "algorithm."

EDIT: On reflection, perhaps Pete is correct that algorithms terminate and methods may not (who am I to argue with Knuth?) However, I don't think that's a distinction that most people will make based only on your use of one word or the other.

mquander
Are you suggesting that we can use the terms interchangebly. I could refer to any method as an algorithm?
kunjaan
I believe that you could refer to any of those kind of mathematical methods as "algorithms" and be both technically correct and understood by mathematicians.
mquander
The terms may be interchangeable to some people — use *algorithm* to refer to a non-finite sequence of steps, and they won't notice or care. Others *will* care, though, so I recommend *not* using the terms interchangeably. It's safer to treat algorithms as a subset of methods. That way, you can communicate effectively with everyone instead of just the people who don't make any distinction anyway.
Rob Kennedy
+1  A: 

I think it is just because the origin domain of algorithm. If the inventor is in computer science background, he may prefer called algorithm. In the domain of math and other sciences, they may prefer called method.

kcwu
+1  A: 

In the context you state (Newton's method, etc.) there is no essential difference between an algorithm and a method. Both are sets step-by-step instructions for solving a problem. In the Wikipedia article on Newton's Method, it states "The algorithm is first in the class of Householder's methods, succeeded by Halley's method". The boundary is blurry at best.

In computer science an algorithm still is a step-by-step manner towards solving a problem - an implementation-agnostic set of steps. A method commonly refers to a chunk of code associated with a class or object that does some task - it can implement many algorithms potentially.

Demi
+2  A: 

In my opinion, a method is a more general concept than algorithm and can be more or less anything, e.g. writing data to a file. Just about anything that should happen due to an event or to some logical expression. Also, the meaning of the words "method" and "algorithm" can vary depending on in what context they are used. They might be used to describe the same thing.

Magnus Skog
+1: Algorithms must be "finite", "definite" and "effective". Newton's method meets all of these; so the terms are interchangeable. Computing my US Income Tax, however, does not appear to be definite -- some terms do not appear to be well-defined -- so it fails to be a proper algorithm.
S.Lott
I don't agree that an algorithm has to be effective. I could construct an algorithm of my own that has really bad performance. Unless you are saying that it turns into a method in that case :)
Magnus Skog
Effective doesn't mean efficient. It means that the steps make progress toward the final state or goal. It means that the algorithm isn't padded with nonsense steps that don't effectively get to the goal.
S.Lott
I hear you! Language barrier present, but now defeated ;)
Magnus Skog
+2  A: 

In general programming speak, algorithms are the steps by which a task is accomplished. According to Wikipedia,

an algorithm is a finite sequence of instructions, an explicit, step-by-step procedure for solving a problem, often used for calculation and data processing. It is formally a type of effective method in which a list of well-defined instructions for completing a task, will when given an initial state, proceed through a well-defined series of successive states, eventually terminating in an end-state. The transition from one state to the next is not necessarily deterministic; some algorithms, known as probabilistic algorithms, incorporate randomness. <

In computer science, a method or function is part of the Object-Oriented philosophy to programming where programs are made out of classes that contains methods/functions to perform specific tasks. Once again, quoting Wikipedia

In object-oriented programming, a method is a subroutine that is exclusively associated either with a class (called class methods or static methods) or with an object (called instance methods). Like a procedure in procedural programming languages, a method usually consists of a sequence of statements to perform an action, a set of input parameters to customize those actions, and possibly an output value (called the return value) of some kind. Methods can provide a mechanism for accessing (for both reading and writing) the encapsulated data stored in an object or a class. <

In short, the algorithm are the steps by which we do something such as turning a light bulb on:

1) Walk to switch 2) Flip Switch 3) Electrons Flow 4) Light generated

Methods are where we actually code actions inside a class.

I am talking abut a different method. Please read the question.
kunjaan
In CS, the algorithm is the steps and the method is the means by which we do an action. All the math formulas would be algorithms as they give us instructions how to find or do something--even if they are called methods in math. We would have to code methods in a program to implement actually implement them.
+1  A: 

Well, for the etymology-lovers

http://www.etymonline.com/index.php?search=algorithm+method&amp;searchmode=or

Chris Dwyer
+10  A: 

Algorithms terminate in a finite number of steps.

A procedure that has all of the characteristics of an algorithm except that it possible lacks finiteness may be called a computational method. Euclid originally presented not only an 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. -- D.Knuth, TAOCP vol 1, Basic Concepts: Algorithms

The Newton Raphson method is not guaranteed to converge, not does it detect convergence failure. If you wrap the method up with convergence detection and termination at a finite epsilon or after a finite number of steps, you get an algorithm.

Pete Kirkham
A: 

Regarding the Ford-Faulkerson Method, CLRS calls it method rather than algorithm because "it encompasses several implementation with different running time"[pp 651. 2nd editon]

kunjaan