An algorithm ( pronounced AL-go-rith-um) is a procedure or formula for solving a problem.A computer can be viewed as an elaborate algorithm.In mathematics and computer science, an algorithm usually means a small procedure that solves a recurrent problem.
A formula or set of steps for solving a particular problem. To be an algorithm, a set of rules must be unambiguous and have a clear stopping point.Algorithm can be expressed in any language from natural languages like English or French programming language like FORTRAN.
We use algorithm every day.For example, a recipe for baking a cake in an algorithm.
Advantage of Generalized Algorithm
It is a foundational element of logic and human reasoning. Generalization points the existence of a domain or set of element, as well as one more common characteristics shared by those elements.
In the case of certain enumerably infinite sets, we can give explicit instructions for determining the n th member of the set, for arbitrary finite n.Such instruction are to be given quite explicitly, in a form in which they could be followed by a computing machine.
Avoiding Infinite Loops in Algorithm-by Counting
A loop is a sequence of statement which is specified once but which may be carried out several times in succession.The code "inside" the loop is executed a specified number of times, or once for each of a collections of items, or until some condition is met.
An infinite loop is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never by met or once that causes the loop to start over.
To be an algorithm, set of rules must be unambiguous and have a clear stopping point.
A loop counter value can be used to tell how many times a statement or block of statement is to be execute.
Avoiding Infinite Loops in Algorithm-by using a Sentinel Value
The following sentinel value are used:-
The break Statement in Loops :
A break statement can be used to end a loop immediately.
A break statement ends only the innermost loop or switch statement that contains the break statement.break statement make loops more difficult to understand.
The continue statement in Loops:
A continue statement
It ends current loop iteration and Begins the next one.
A formula or set of steps for solving a particular problem. To be an algorithm, a set of rules must be unambiguous and have a clear stopping point.Algorithm can be expressed in any language from natural languages like English or French programming language like FORTRAN.
We use algorithm every day.For example, a recipe for baking a cake in an algorithm.
Advantage of Generalized Algorithm
It is a foundational element of logic and human reasoning. Generalization points the existence of a domain or set of element, as well as one more common characteristics shared by those elements.
In the case of certain enumerably infinite sets, we can give explicit instructions for determining the n th member of the set, for arbitrary finite n.Such instruction are to be given quite explicitly, in a form in which they could be followed by a computing machine.
Avoiding Infinite Loops in Algorithm-by Counting
A loop is a sequence of statement which is specified once but which may be carried out several times in succession.The code "inside" the loop is executed a specified number of times, or once for each of a collections of items, or until some condition is met.
An infinite loop is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never by met or once that causes the loop to start over.
To be an algorithm, set of rules must be unambiguous and have a clear stopping point.
A loop counter value can be used to tell how many times a statement or block of statement is to be execute.
Avoiding Infinite Loops in Algorithm-by using a Sentinel Value
The following sentinel value are used:-
The break Statement in Loops :
A break statement can be used to end a loop immediately.
A break statement ends only the innermost loop or switch statement that contains the break statement.break statement make loops more difficult to understand.
The continue statement in Loops:
A continue statement
It ends current loop iteration and Begins the next one.
0 Comments:
Post a Comment