Welcome
Algorithm
Content
What is algorithm
History of algorithm
How to write an algorithm
Purpose
Diagram
Characteristics of algorithm
Properties of algorithm
Types of algorithm
examples
What is Algorithm?
An algorithm is a well-defined procedure that allows a computer to
solve a problem.
An algorithm is a set of step by step instructions that describe how to
perform a task.
History of Algorithm
An algorithm (AL-go-rith-um)is procedure or formula for solving a
problem.
The word derives from the name of the mathematician
,Muhammad Ibn-Musa-al-Khwarizmi, who was part of the royal
court in Baghdad.
How to write an algorithm?
Keep in mind that algorithm is a step-by-step process.
Depending upon programming language, include syntax where
necessary.
Include variables and their usage.
If they are any loops, try to give sub number lists.
Try to give go back to step number if loop or condition fails.
Use jump statement to jump from one statement to another.
Purpose
For solving complex problems effectively and effectively.
They help for the automation process and make them more reliable
fasten and easier.
It make task possible which is difficult or impossible for human and
computer.
Characteristics of Algorithm
The characteristics of a good algorithm are :
Precision - the steps are precisely stated(defined).
Uniqueness – results of each step are uniquely defined and only
depend on the input and the result of the preceding steps.
Finiteness – the algorithm stops after a finite number of instructions
are executed.
Properties of algorithm
An algorithm must have five properties :
Input specified
Output specified
Definiteness
Effectiveness
Finitenesss
Types of algorithm
Algorithm types we will consider include :
Simple recursive algorithms.
Backtracking algorithms.
Divide and conquer algorithms.
Dynamic programming algorithms.
Greedy algorithms.
Branch and bound algorithms.
Brute force algorithms.
Randomized algorithms.
Example :
Delaited algorithm:
Step1:input M1,M2,M3,M4.
Step2:GRAND ?(M1+M2+M3+M4)/4
Step3:if (GRADE<50)
Then
Print “FAIL”
Else
Print “PASS”
End if
Example:
Pseudocode:
Input the length in feet (Lft)
Calculate the length in cm (Lcm) by multiplying LFT with 30
Print length in cm (LCM)
Example :
Algorithm:
Step1: Input Lft
Step2: Lcm ?Lft x 30
Step3: Print Lcm.
Presented by :
Awais ishfaq
thank
you…..