๐ŸŽ 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

Dependency Injection
A design pattern where objects receive their dependencies from external sources rather than creating them internally.
Linked List
A linear data structure where elements are stored in nodes, each containing data and a pointer to the next node in the sequence.
Garbage Collection
An automatic memory management process that identifies and reclaims memory no longer in use by a program.
Composition over Inheritance
A design principle favoring object composition (has-a relationships) over class inheritance (is-a relationships) for code reuse.
Concurrency
The ability of a program to manage multiple tasks that can make progress during overlapping time periods.
Factory Pattern
A creational design pattern that provides an interface for creating objects without specifying their exact classes.
View All Programming Concepts Terms โ†’