Wednesday, March 1, 2023
HomeSoftware DevelopmentWhat's Binary Search Algorithm?

# What’s Binary Search Algorithm?

Binary Search is a looking algorithm utilized in a sorted array by repeatedly dividing the search interval in half and the proper interval to seek out is set based mostly on the searched worth and the mid worth of the interval.

Instance of binary search

### Properties of Binary Search:

• Binary search is carried out on the sorted knowledge construction for instance sorted array.Â
• Looking out is completed by dividing the array into two halves.Â
• It makes use of the divide-and-conquer method to seek out a component.

### Pre-requisites to use Binary Search Algorithm:

For making use of binary search in any knowledge construction, the info construction should fulfill the next two circumstances:

• The info construction is sorted.
• Any random ingredient of the info construction might be immediately accessed i.e., might be accessed in fixed time.

### Functions of Binary Search:

• The binary search operation is utilized to any sorted array for locating any ingredient.Â
• Binary search is extra environment friendly and sooner than linear search.Â
• In actual life, binary search might be utilized within the dictionary.
• Binary search can be used to debug a linear piece of code.
• Binary search can be used to seek out if a quantity is a sq. of one other or not.

RELATED ARTICLES