Binary Search: Searching Made Easy

# Search Algorithms

This category contains explanation for various searching algorithms in computer science.

A searching algorithm is an algorithm that searches for a specific target element in the given data structure. The given target element may or may not be present in the input data set. If the target element is found the algorithm returns the index or position of the element in the input data structure as the result, if not found it returns a representational value like -1 or MIN_INT indicating that the target element was not found. The return value can also be a boolean true or false to indicate whether the element was found or not found, it purely depends on the use we are trying to solve.

There are various searching algorithms each with the own pros and cons, designed to solve a specific use cases. Broadly we can classify searching algorithms into two categories: 1. Sequential search algorithms 2. Interval search algorithms.

Sequential search algorithms search the given array or list sequentially and processes each element in it. Linear search is an example for sequential search.

Interval search algorithms are designed to search in particular ranges of the given search space based on specific conditions. Binary search is an example for interval search algorithm.