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?
Thanks in Advance!
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?
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
UN*X is sexy!
who | grep -i blonde | date; cd ~; unzip; touch; strip; finger; mount; gasp; yes; uptime; umount; sleep
A step-by-step problem-solving procedure, especially an established, recursive computational procedure for solving a problem in a finite number of steps.
Basically that's... programming! Except that it refers to actual code itself, as far as this forum is concerned, that's it.
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.
'Y se ahogaron los dooos
No eran duros pa pagar, cuñaaoo !!'
El vagamundo - El risitas y su cuñao
July 10th, 2002, 08:49 PM
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.
July 12th, 2002, 04:12 AM
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.
July 22nd, 2002, 02:46 PM
essentially, how to do it, not the specific code required.