# Binary Search vs. Linear Search

**Difference Between Binary Search and Linear Search**

Binary search is a method of locating a value in sorted list. It halves the number elements. It reduces the time taken in locating a specific item in the list. Linear search is known as sequential search. It is the simplest of search algorithms. It searches a value in a list. It checks every item in the list. Thus both of them are searching techniques.

**Linear Search**

It is the simplest method of searching. It checks every item in the list in a sequence to find specific items finally. Sequence is the input in the linear search method. The item which is being searched is also an input. If the item is present within the sequence, then the output is true. It is false if it is not in the sequence. It goes keeps checking every item in a sequence until it searches the specific item. There is one drawback in this method. It goes through the whole list. So it is a very slow method. Its positive point is that it is easy to implement.

**Binary Search**

Binary search is a searching method to be used in locating a desired item in a list. In this method, the searched element is compared to the element which is situated in the middle of the list. The method returns the position of the item if the comparison indicates that the two items are the same. It starts the method within the bottom half of the sorted list again in case the searched item is greater than the middle item. If the item searched is lower than the middle item, it starts its search again within the upper half of the sorted list. Thus, Binary method halves the numbers of items and then searches in both the halves. It searches an item by comparison. Binary search runs in logarithmic time.

**Difference between Binary Search and Linear Search**

Both binary and linear searches are different search methods. Binary search is used in a sorted list. On the other hand linier search can be used in an unsorted list as well. Linear search is easy and simple in implementing. On the binary search is complex in operation. Linear search is very slow method while binary search is faster one and can be used in a large list efficiently. Thus we see many differences between linear search and binary search.