What is an Algorithm?
What is an Algorithm?
An algorithm is an effective and best method and step by step procedure for solving any problem which can be used to express solution of any problem within a finite amount of space and time.
Characteristics of an Algorithm
1. Input:
There are more qualities that are extremely supplied.
2. Output:
At least one quantity is produced.
3. Unambiguity:
Each step must be non ambiguous that means each instruction should br clear and precise.
4. Finiteness:
The process should be terminated after a limited number of steps.
5. Effectiveness:
An algorithm is also generally expected to be effective.This means that all of operations to be perfomed in all algorithm must be sufficiently basic that they can in principle be done exactly and in a finite length of time
6. Language independent:
An algorithm must be language-independent so the instructions in an algorithm isimplemented in any of the languages with the same output.
Data flow of an algorithm
1. Problem:
A problem can be a real-world problemmable problme or the problem statement usually gives the programmer idea of issues and available resources come with plan to solve it.
2. Algorithm:
An algorithm will be designed the step by step procedure to solve a problem efficiently.
3. Input:
After designing an algorithm, the relevant and desired inputs are provided.
4. Processing unit:
The processing unit receives these inputs, and the this unit will produce the desired output.
5. Output:
After the processing,we recive the output is the outcome
How to Write an Algorithm?
Algorithms are never written to support or no predefined standards a particular programming code.
These common constructs used to write an algorithm or used of pseudocode.Algorithm is write by step by step manner.When we wite the algorithm the domain of problem should be well defined.
Algorithm Examples
Algorithm 1: Write algorithm to accept three numbers and print their sum.
Step 1-START Step 2- Declare variables x,y,z and add Step 3- Read the value of x,y and z Step 4- Add x,y and z Step 5-Store the output of Step 4 in add Step 6-Print add Step 7- STOP
Algorithm 2: Find the largest number between three numbers
Step 1: Start Step 2: Declare variables a,b and c. Step 3: Read variables x,y and z. Step 4: If x > y If x > z Display x is the largest number. Else Display z is the largest number. Else If y > z Display y is the largest number. Else Display z is the greatest number. Step 5: Stop
Read more