Linear Search
It is one of the searching technique.
It takes the element and it compares the all the elements in the array until the desired element is found.
Algorithm
We have an array A and we have to find the element X.
Step 1: Set i =1
Step 2: if i > n then Print element not found and EXIT
Step 3: if A[i] = X then Print element found and EXIT
Step 4: Set i=i+1 and Go to Step 2
It is one of the searching technique.
It takes the element and it compares the all the elements in the array until the desired element is found.
Algorithm
We have an array A and we have to find the element X.
Step 1: Set i =1
Step 2: if i > n then Print element not found and EXIT
Step 3: if A[i] = X then Print element found and EXIT
Step 4: Set i=i+1 and Go to Step 2
No comments:
Post a Comment