Binary Search
Last updated
What is Binary Search?
Binary Search is a type of search algorithm that follows the divide and conquer strategy. It works on a sorted array by repeatedly dividing the search interval in half. Initially, the search space is the entire array and the target is compared with the middle element of the array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target, and repeating this until the target is found. If the search ends with the remaining half being empty, the target is not in the array. Binary Search is log(n) as it cuts down the search space by half each step.
Free resources to learn Binary Search
More in stage 8: Search Algorithms
Binary Search: common questions
Can I learn Binary Search in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Binary Search in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Binary Search tutorial for beginners?
It is lesson 40 of 107 in the free Data Structures & Algorithms roadmap, in stage 8, Search Algorithms. If you are new to Data Structures & Algorithms, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.