What is the difference between an Algorithm and a Method
Asked Answered
Y

12

22

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?

Yelena answered 18/5, 2009 at 18:0 Comment(2)
Are you asking in the context of (software) patents?Wiegand
No, just a general question. However could you please answer it in context of patents too?Yelena
Y
-1

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]

Yelena answered 18/5, 2009 at 18:35 Comment(0)
C
29

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.

Coremaker answered 18/5, 2009 at 18:13 Comment(0)
A
8

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.

Anuria answered 18/5, 2009 at 18:5 Comment(3)
Are you suggesting that we can use the terms interchangebly. I could refer to any method as an algorithm?Yelena
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.Anuria
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.Connubial
V
3

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.

Vaules answered 18/5, 2009 at 18:9 Comment(4)
+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.Linda
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 :)Vaules
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.Linda
I hear you! Language barrier present, but now defeated ;)Vaules
J
2

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.

Jordison answered 18/5, 2009 at 18:12 Comment(3)
I am talking abut a different method. Please read the question.Yelena
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.Jordison
@Jordison You're referring to the term method which is defined only in the OOP scope (a function of a class), while the question's author is asking about the generic term (a tool for solving problems), that makes your comparison a bit absurdParmentier
D
1

Well, for the etymology-lovers

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

Dithionite answered 18/5, 2009 at 18:12 Comment(0)
S
1

Algorithm is just like a formula to solve any particular problem step by step,with no ambiguity to any step, and must have some ending point. methodology is more general form of any solution. it provided a way how to solve any problem but in algorithm the way is more precisely formulated towards solution.

Snapshot answered 28/2, 2011 at 18:5 Comment(0)
G
1

Method is analogous to a strategy, algorithm is analogous to the tactics. An example: in war, you develop a strategy (method) to take over a country: take ports first, advance west on land, then surround capital, etc. This strategy is divided in several tactical stages (algorithms): first, one that tells the soldiers step by step exactly how they are going to take the ports; then, one that tell the soldiers how they must advances west; then, one with the exact steps for the soldiers to surround the city, etc.

Goggin answered 10/5, 2016 at 21:1 Comment(0)
C
0

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.

Corporative answered 18/5, 2009 at 18:6 Comment(0)
P
0

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.

Photochronograph answered 18/5, 2009 at 18:8 Comment(0)
C
0

A procedure can go on forever. Where as an Algorithm, will eventually terminate and will have each step precisely defined.

Cozmo answered 14/2, 2013 at 5:5 Comment(0)
S
0

Alan Turing was the first to introduce the word "algorithm" in mathematical literature. According to Gödel,

Turing’s work gives an analysis of the concept of ‘mechanical procedure’ (alias ‘algorithm’ or ‘computation procedure’ or ‘finite combinatorial procedure’). This concept is shown to be equivalent with that of a ‘Turing machine’

In other words an algorithm is a computable function together with a method of computation, that is correct and finite. Note that a well-defined function has certain value for every possible argument. On the other hand method is a strictly formalized way of doing something. So every algorithm is a method, but not vice versa. Methods not being algorithms may:

  • Be (potentially) not finite.
  • Give (potentially) incorrect answer.
  • Solve problems with multiple correct answers.
  • Solve problems with no definitely correct answer (including real-life image recognition).
  • Solve undecidable problems.

On the other hand classic algorithm has three main properties:

  • Provable finiteness.
  • Provable correctness.
  • Two different algorithms for the same problem give the same answer.

Nowadays people try to use word algorithm for any well-defined action, i. e., instead of word method. But more or less reasonable direction to extend meaning of word algorithm keep the key property of provability of correctness (with pen and paper) and ability to bound running time. Meaning of correctness may also be extended to provide some property of the answer, not one-to-one equality only. E. g., approximation scheme gives solution within some known distance from the optimal one.

Further extension of correctness meaning is about giving correct answer with known probability (which still can be lower-bounded with pen and paper by a constant or a function of input size). At the same time we can speak about expected running time and being finite almost always (with probability 1). These two extensions together bring us to probabilistic algorithms.

So if we return to the question about Newton's method and Ford—Fulkerson method, then the answer is the following: these methods are not algorithms in Turing's definition. Newton's method both is not finite and gives one of multiple root, while Ford—Fulkerson method gives one of multiple flows. But as soon as we extend meaning of correctness allowing multiple correct solutions, Ford—Fulkerson method becomes an algorithm. If we at the same time accept as correct any answer close enough to a root, then Newton's method becomes an algorithm for computing an approximation of root of a function with continuous second derivative.

Stunning answered 21/5 at 16:53 Comment(0)
Y
-1

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]

Yelena answered 18/5, 2009 at 18:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.