### What is an Algorithm?

posted Oct 20, 2013, 10:51 PM by Anupinder Singh   [ updated Mar 3, 2014, 2:29 AM by Anupinder Singh ]
 Next - Performance Analysis >DefinitionsThere are various definitions available for term Algorithm as:"A set of rules for solving a problem in a finite number of steps" - Dictionary"A set of steps that are followed in order to solve a mathematical problem or to complete a computer process" - Merriam-Webster"An Algorithm is any well defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values as output"- refer to References"A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer." - GoogleAny of the above mentioned definition will work, and even all definitions provides a similar summary i.e. a set of well defined steps to solve a defined problem corresponding to provided inputs.Five characteristics of an Algorithm are:Input: Accept Zero or more inputs externally.Output: Must produce at least one output as result of procedure.Definiteness: Each instruction must be clear and unambiguous.Finiteness: If all the instructions are traced in algorithm, then for all cases the algorithm must terminate after a finite number of steps.Effectiveness: Every instruction must be very basic so that it can be carried out  and must be feasible to perform on any machine. One important point about algorithm, it is not a computer program. Instead it is a procedure written as pseudo code or English language type description, providing information about what calculations are to be performed and in which flow.For Example : To add two numbers we can have an algorithm like:English language Type`    1. Ask user to enter two integer numbers.``    2. Add both the integer numbers.``    3. Print the final sum value of two numbers`ORPseudo Code Type` ``   ``Algorithm`` SUM``    ``    ``Input: ``Two Integer Numbers as ONE, TWO``   ``    `` ``Output``: sum of ONE & TWO as RESULT``    ``    ``ONE <- User input required``    ``    ``TWO <- User input required``    ``    ``RESULT <- ONE + TWO``    ``    ``return RESULT`ORFlowchart RepresentationIn case you want to show it visually it can be represented as:Even for some cases all the three types of defining the algorithm is used. I depends on what kind of document you are working on.Next - Performance Analysis >