[ACCEPTED]-What is the difference between an Algorithm and a Method-methods

Accepted answer
Score: 28

Algorithms terminate in a finite number 17 of steps.

A procedure that has all of the 16 characteristics of an algorithm except that 15 it possible lacks finiteness may be called 14 a computational method. Euclid originally 13 presented not only an algorithm for the 12 greatest common divisor of numbers, but 11 also a very similar geometrical construction 10 for the "greatest common measure" of the 9 lengths of two line segments; this is a 8 computational method that does not terminate 7 if the given lengths are incommensurable. -- D.Knuth, TAOCP 6 vol 1, Basic Concepts: Algorithms

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

Score: 8

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

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

Score: 3

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

Score: 3

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

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

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

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

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

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

Methods are where we actually code actions 1 inside a class.

Score: 1

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

Score: 1

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

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

Score: 1

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

Score: 1

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

Score: 0

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

More Related questions