CPKit
v1.6.1

Binary Search

SearchingEasy

Halve search bounds logarithmically on sorted arrays.

Alt+Shift+B

Configuration Panel

Logarithmic Interval Splits Visualizer

5
0
8
1
12
2
16
3
23
4
38
5
56
6
72
7

Time Complexity

O(log N) search bounds cuts

Space Complexity

O(1) auxiliary variables
Conceptual Overview

Binary Search halves the search space at each step by comparing the target to the middle element of a sorted array.

Algorithm Idea

Initialize pointers low = 0, high = N - 1. While low <= high, evaluate mid = (low + high)/2. Update bounds based on target comparison.

Stable Sorting

N/A

In-place Memory

N/A

Source: CP-Algorithms search & sorting reference