Thursday, March 2, 2023
HomeSoftware developmentWhat's Binary Search Algorithm?

What’s Binary Search Algorithm?


Enhance Article

Save Article

Like Article

Enhance Article

Save Article

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 primarily based on the searched worth and the mid worth of the interval.

Example of binary search

Instance of binary search

Properties of Binary Search:

  • Binary search is carried out on the sorted information construction for instance sorted array. 
  • Looking 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 information construction, the information construction should fulfill the next two circumstances:

  • The information construction is sorted.
  • Any random ingredient of the information construction could be straight accessed i.e., could 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 could 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.

What else are you able to learn?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments