Searching Algorithms
Searching Algorithms
A search algorithms is a step-by-step procedure using to locate specific data among collection of data.
Types of search algorithms with the complexity
1. Linear Search:
A linear search or sequential search is a method for finding an element within a list. It is sequentially checks each element of the list until a match is found or the whole list has been searched.
C(n)= n/2
← Complexity of linear Search.
2. Binary Search:
In Binary search approach the element is always searched in the middle of a portion of an array.
Binary search can be implemented only on a stored list of items.
If the element are not sorted already, we need to sort them first.
C(n)= log₂n
← Complexity of Binary search.