### Thread: What is an Algorithm?

1. #### What is an Algorithm?

I know I am showing my ignorance when I say this, but what is an Algorithm? How is it used and can I use it in my PHP scripts?

Sam Powers
2. Hi!

An algorithm is a non-ambiguous set of step-by-step actions to be taken in order to solve a problem. Often this is rendered in pseudo code (abstracted from any PHP or other).
A PHP program would be one (of many possible) implementations of this algorithm.

Am I missing something? Any informatics pros here?

Regards,

Atrus.
3. Found this somewhere:
Algorithm is the process of abstracting the data, operations, and semantics of a problem, and then creating solutions out of those abstractions.

Info about the guy who is said to have invented this stuff-> http://www-groups.dcs.st-and.ac.uk/~...Khwarizmi.html

//NoXcuz
4. No Profile Picture
Junior Member
Devshed Newbie (0 - 499 posts)

Join Date
May 2002
Location
Posts
1
Rep Power
0
al·go·rithm n.

A step-by-step problem-solving procedure, especially an established, recursive computational procedure for solving a problem in a finite number of steps.
5. Basically that's... programming! Except that it refers to actual code itself, as far as this forum is concerned, that's it.
6. No Profile Picture
Canta como rafaé
Devshed Newbie (0 - 499 posts)

Join Date
Feb 2001
Location
Barcelona
Posts
74
Rep Power
18
An algorithm is the process to solve a problem not necessarily depending on computers.

"sum 1 to the variable i" is implemented as \$i = \$i + 1 in PHP or i++ in C.
7. No Profile Picture
Junior Member
Devshed Newbie (0 - 499 posts)

Join Date
Jul 2002
Location
Posts
7
Rep Power
0

#### Algorithms

While most agree that algorithm can't be precisely defined in terms required for further manipulation, most "describe" it in a way as given above, or as a:

"description of proccesses involved in solving a particular task"

Though commonly used in computer science, it's roots are in mathematics, and that's what brings maths into computer science (actually vice versa, if we take a look at the history).

The main points about algorithms are:
1. what input is a particular algorithm expecting?
2. what output will it give if input was "correct" (as expected)?
3. what time will it take to complete ("efficiency" and directly related "complexity" of an algorithm)?

This means that given same input data, a particular algorithm is expected to give same output in about the same time (counted in time units particular for a machine type and speed), no matter what language it is implemented in (C, C++, Java, PHP, Perl, Python, and lots of others most probably never heard of).

There are several "formalizations" of algorithms, the most common one being the "Turing machine". With it, an algorithm is a description of a states and steps requried to compute something. This would require more formal understanding, so I won't discuss it anymore.

That's it.
8. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Sep 2000
Location
Sydney, NSW, Australia
Posts
40
Rep Power
18
Algorithms and slightly different to pseudo-code. An Algorithm is much more descriptive, and doesn't contain mathematical symbols etc. Pseudo-code is the next step in the software development cycle. Someone goes through and translates the algorithms into descriptions closer to the actual programming language that it is to be translated into. Once this is done, the programmer converts the pseudo-code into the code that is to be used.

Algorithms and Pseudo-code are very important steps in the software development cycle. Algorithms really encourage good software design, and encourage you to find the best solution to a problem. Start using algorithms with your PHP, your code will turn out a lot better.
9. No Profile Picture
Junior Member
Devshed Newbie (0 - 499 posts)

Join Date
Jul 2002
Posts
10
Rep Power
0
essentially, how to do it, not the specific code required.

Qin_23