Ads

Saturday, 25 February 2017

Data Structure - Searching - Linear

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

No comments:

Post a Comment

SOLID Principles

SOLID principles are the basic essential thing to know for every developer before he/she starts coding in any IDE. Here is the full form S ...