0
3.0kviews
What is an Algorithm? How do you develop an algorithm?

Subject : Structured Programming Approach

Title : Introduction to Computer, Algorithm and Flowchart

Marks : 4M

1 Answer
0
71views

The definition of algorithm is,

Program = Algorithm + Data

An algorithm is a part of the plan for the computer program. It is effective procedure for solving a problem in a finite number of steps. A well-defined algorithm will always provide an answer and also guaranteed to terminate.

Different ways to stating Algorithm

Algorithm may be represented in following ways

a) Step-form

b) Pseudo-code

c) Flowchart

d) Nassi-Schneiderman

a) Step-form: In this representation, the procedure of solving a problem is stated with written statements. Each statement solves a part of the problem and these together complete the solution.

b) The Pseudo-code is a written form representation of the algorithm. However it differs from step form as it uses a restricted vocabulary to define its action of solving the problem.

c) Flowchart and Nassi – Schneiderman are graphically oriented representation forms. They use symbols and language to represent sequence, decision and repetition actions.

a) Sequence or Process Sequence means that each step or process in the algorithm is executed in the specified order.

The decision constructs- if - then, if - then - else

In algorithm the outcome of a decision is either true or false. For Ex. if tomorrow is Sunday then go to picnic

The repetition constructs – repeat and while

The Repeat loop is used to iterate or repeat a process or sequence of processes until some condition becomes true. The general form:

Repeat

fill the water in kettle

until kettle is full

While kettle is empty

fill the water

Termination

The algorithm should terminate in the definite steps and it should give correct solution of the problem.

Correctness

Correctness means how easily its logic can be argued to meet the algorithm’s primary goal. It is degree to which an algorithm performs its specified function.

Please log in to add an answer.