You are on page 1of 3

CONCEPTS AND PROPERTIES OF ALGORITHMS

Problem solving is a process of transforming the description of a problem into the solution of that
problem by using our knowledge of the problem domain and by relying on our ability to select and
use appropriate problem-solving strategies, techniques and tools. Effective problem solving
technique begins with breaking problem solving into a series of activities called algorithm.

An algorithm is a step-by-step procedure of solving a problem. It is a series of activities to be


processed for getting desired output from a given input. An algorithm has input data, and is
expected to produce output data after carrying out a process which is the actions taken to achieve
the required outcome. An algorithm is not a computer program; a computer program is the
implementation of an algorithm.

An algorithm must satisfy these requirements:


 It must have input (s)
 It must have an output
 It should not be ambiguous- Every step in algorithm must be clear as what it is supposed to
do
 It must be general (it can be used for different inputs)
 It must be correct and it must solve the problem for which it is designed
 It must execute and terminate in a finite amount of time
 It must be efficient enough so that it can solve the intended problem using the resource
currently available on the computer

Control Structures in computer programming


1. Sequence structure
A sequence is one of the basic logic structures in computer programming. In a sequence structure,
an
action, or event, leads to the next ordered action in a predetermined order. The sequence can
contain any number of actions, but no actions can be skipped in the sequence. Once running, the
program must perform each action in order without skipping any. Most standard computer
algorithms are sequential.
2. Selection structure
A selection (also called a decision) is also one of the basic logic structures in computer programming.
In a selection structure, a question is asked, and depending on the answer, the program takes one of
two courses of action, after which the program moves on to the next event
3. Iteration structure
An iteration is a single pass through a group/set of instructions. Most programs often contain loops
of instructions that are executed over and over again. The computer repeatedly executes the loop,
iterating through the loop.
Algorithm to make a cup of tea

Control Structures in computer programming

Examples
a. Write an algorithm to convert the length in feet to centimeter.
Inputs to the algorithm:
length in feet
Expected output:
length in centimetre
Algorithm
Enter the length (L)in feet (Lft)
Calculate the length (L) in cm by multiplying Lft with 30
Print Length in cm (Lcm)
Stop
b. Find the area of a Circle of radius r.
Inputs to the algorithm:
Radius r of the Circle.
Expected output:
Area of the Circle
Algorithm:
Start
Input the Radius r of the Circle
Area = PI*r*r // formula to calculate area of a circle
Print Area
Stop
c. Write an algorithm to read two numbers and find their sum.
Inputs to the algorithm:
First num1.
Second num2.
Expected output:
Sum of the two numbers.
Algorithm:
Start
Input the first num1.
Input the second num2.
Sum num1+num2 // summation of two numbers
Print Sum
End

You might also like