What is an Algorithm?

An algorithm is a finite set of precise instructions for performing a computation or solving a problem. Programmers usually write an algorithm in pseudocode before actually coding it. (image 1)
Properties of an algorithm:
* input: input values from a specified set
* output: from the input values, the algorithm produces output values from a specified set; they are the solution
* correctness: an algorithm should produce correct output values for each set of input values
* finiteness: there should be a finite number of steps for any input that produce the output
* effectiveness: it should be possible to perform each step of the algorithm correctly and in a finite amount of time
* generality: the algorithm should work for all problems of the desired form
example of psuedo code (image 2)

0 comments