๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

Programming Concepts Beginner

What is Binary Search?

An efficient search algorithm that finds a target value in a sorted array by repeatedly dividing the search interval in half.

Binary search compares the target to the middle element. If smaller, search the left half; if larger, search the right half. Each step eliminates half the remaining elements, giving O(log n) time complexity โ€” searching 1 million items takes at most 20 comparisons.

Prerequisites: the data must be sorted. Binary search is used in database index lookups, dictionary searches, and finding insertion points. Variations include lower/upper bound searches and bisection methods for continuous functions.

Related Terms

Closure
A function that captures and retains access to variables from its enclosing scope, even after that scope has finished executing.
Refactoring
Restructuring existing code without changing its external behavior to improve readability, maintainability, and performance.
SOLID Principles Breakdown
Five object-oriented design principles that guide developers in creating maintainable, flexible, and scalable software systems.
Data Structure
A way of organizing and storing data in a computer so it can be accessed and modified efficiently.
Regex (Regular Expression)
A sequence of characters that defines a search pattern, used for string matching, validation, and text manipulation.
Queue
A data structure that follows First-In-First-Out (FIFO) ordering, where elements are added at the rear and removed from the front.
View All Programming Concepts Terms โ†’