Paul Gichure

Posted on

# Data Structure Algorithms: Linear Search

Data Structures are the programmatic way of storing data for efficient use. In this series, you will get great understanding on Data Structures needed to understand the complexity of enterprise level applications and need of algorithms and data structures. Good understanding of DSA helps address the following problems;

1. Enormous data Search
2. Limited processor speed
3. Handling multiple concurrent requests

#### Linear Search

Linear search is a search algorithm where a sequential search is made over all items one by one. Every item is checked and if a match is found then that particular item is returned, otherwise the search continues till the end of the data collection.

#### Algorithm

``````Linear Search (Array A, Value x)

Step 1: Set i to 1
Step 2: if i > n then go to step 7
Step 3: if A[i] = x then go to step 6
Step 4: Set i to i + 1
Step 5: Go to Step 2
Step 6: Print Element x Found at index i and go to step 8
Step 8: Exit
``````

#### Pseudocode

``````function linear_search (list, value)

for each item in the list
if match item == value
return the item's location
end if
end for

end function
``````

#### Source Code

An example can be found here.

DEV Community

Timeless DEV post...

## Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.