Javatpoint Logo
Javatpoint Logo

Algorithm

An algorithm can be defined as a well-defined computational procedure that takes some values, or the set of values, as an input and produces some value, or the set of values, as an output. An algorithm is thus a sequence of computational steps that transform the input into output.

It describes specific computational procedures for achieving the input-output relationship.

For Example, We need to sort the sequence of number into ascending order. Here is how we define the sorting problem.

Input:

A sequence of n number (a1, a2,......an)

Output:

A permutation (reordering) (a'1, a'2 .... a'n) of the input sequence such that (a'1 ≤ a'2 ≤ ....≤ a'n)

An algorithm must have the following properties:

  • Correctness: It should produce the output according to the requirement of the algorithm
  • Finiteness: Algorithm must complete after a finite number of instructions have been executed.
  • An Absence of Ambiguity: Each step must be defined, having only one interpretation.
  • Definition of Sequence: Each step must have a unique defined preceding and succeeding step. The first step and the last step must be noted.
  • Input/output: Number and classification of needed inputs and results must be stated.
  • Feasibility: It must be feasible to execute each instruction.
  • Flexibility: It should also be possible to make changes in the algorithm without putting so much effort on it.
  • Efficient - Efficiency is always measured in terms of time and space requires implementing the algorithm, so the algorithm uses a little running time and memory space as possible within the limits of acceptable development time.
  • Independent: An algorithm should focus on what are inputs, outputs and how to derive output without knowing the language it is defined. Therefore, we can say that the algorithm is independent of language.

Next TopicNeed of Algorithm




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA