Linear Search :

LINEAR_SEARCH () :
A is an array with N element. Val Is the value to be searched.

Step I    : Repeat For I = 1 to N
Step II  :       If ( Val == A[I] ) Then
Step III :                Print : Val found at location I
Step IV :  Return
[ End of If ]
          [ End of For loop ]
Step V : If ( I > N ) Then 
Step VI :      Print : Val doesn’t exist
[ End of If ]
Step VII : Exit

Explained using Figure :-

Here Searching Value is 7 —
LS

Leave a comment