# Linear Search
`Linear search` is a search algorithm that finds the position of a target value within an array.

## Algorithm
Linear search (also called sequential search) is a method for finding a target value within an array. It sequentially checks each element of the array until the target value is found or until all the elements have been checked. Linear search runs in at worst linear time and makes at most n comparisons, where n is the length of the list.

The pseudocode for linear search is as follows:
```
for each item in the list:
	if that item is the target value:
		stop search and return item's position
return -1
```

## Complexity
**Time complexity** - O(n), where n is the number of elements in the array.

**Space complexity** - O(1).

## Implementation
* [CoffeeScript Code](https://github.com/jainaman224/Algo_Ds_Notes/blob/master/Linear_Search/Linear_Search.coffee)

	> :rocket: [Compile Online](https://repl.it/EC2b/0) :rocket:

* [C++ Code](https://github.com/jainaman224/Algo_Ds_Notes/blob/master/Linear_Search/Linear_Search.cpp)

	> :rocket: [Compile Online](https://repl.it/EC29/0) :rocket:

* [C# Code](https://github.com/jainaman224/Algo_Ds_Notes/blob/master/Linear_Search/Linear_Search.cs)

	> :rocket: [Compile Online](https://repl.it/EC28/0) :rocket:

* [Java Code](https://github.com/jainaman224/Algo_Ds_Notes/blob/master/Linear_Search/Linear_Search.java)

	> :rocket: [Compile Online](https://repl.it/EC27/0) :rocket:

* [JavaScript Code](https://github.com/jainaman224/Algo_Ds_Notes/blob/master/Linear_Search/Linear_Search.js)

	> :rocket: [Compile Online](https://repl.it/repls/OliveBlissfulMerganser) :rocket:

* [Php Code](https://github.com/jainaman224/Algo_Ds_Notes/blob/master/Linear_Search/Linear_Search.php)

	> :rocket: [Compile Online](https://repl.it/EC26/0) :rocket:

* [Python Code](https://github.com/jainaman224/Algo_Ds_Notes/blob/master/Linear_Search/Linear_Search.py)

	> :rocket: [Compile Online](https://repl.it/EC21/0) :rocket:

* [Ruby Code](https://github.com/jainaman224/Algo_Ds_Notes/blob/master/Linear_Search/Linear_Search.rb)

	> :rocket: [Compile Online](https://repl.it/EC23/0) :rocket:
