Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithm.

Similar presentations


Presentation on theme: "Algorithm."— Presentation transcript:

1 Algorithm

2 Algorithm Defination An Algorithm is a finite set of instructions that if followed accomplishes a particular task.

3

4 Characteristics of an Algorithm
Finiteness Definiteness Effectiveness Input Output

5 Algorithm design tools
Name of the algorithm and an introductory Comment. Steps Comments Assignments Statements Exit Statement Variable Name Operators Input and Output Statements Flow Chart

6 Name of the algorithm and an introductory Comment.
LINEAR_SEARCH(A,N,KEY) [ ALGORITHM TO PERFORM LINEAR SEARCH]

7 Steps 1. …….. 2…….. 3…….

8 COMMENTS [ ] Comments are written in brackets

9 Assignments Statements
Dot and equal to O= Var o= 45

10 Exit Statement Exit / finished / end

11 Variable Name In capital Eg :- VAR1 VAR2

12 OPERATORS LOGICAL OPERATOR (AND &&,OR ||,NOT !)
RELATIONAL OPERATOR (<,>,<=,>=) ARTHEMATIC OPERATOR (+,-,*,/)

13 Input and Output Statements
Read : VAR (SCANF() ) ACCEPT DATA FROM USER Write Message (Printf() print data on the screen

14 Flow Chart

15 Types Of algorithm Brute Force Divide and Conquer Dynamic Programming
Greedy Algorithm

16 Performance Analysis Space Complexity
It is the amount of memory required for that particular algorithm. Time Complexity Deals with the computing time.

17 Space Complexity. void main() { int a; float b,c; c = a+b;
printf(“Result = %d”,c) } Space Required = = 10 bytes.

18 Time Complexity void main() { int a; --------------- 1
float b,c; c = a+b; printf(“Result = %d”,c); } Total Frequency count = = 4

19 Time Complexity void main() { int a,n; --------------- 1
float b,c; n = 3 for(i=0;i<=n;i++) n c = a+b+i; n printf(“Result = %d”,c); n } Total Frequency count = 1+1+n+n+n = 11

20 Big ‘O’ Notation Provides asympostotic upper bound for a given functions Max (O(1),O(n),O(n+1),O(n^2)


Download ppt "Algorithm."

Similar presentations


Ads by Google