CPKit
v1.6.1

Lower Bound

SearchingEasy

Find the first index where element >= target in a sorted collection.

Alt+Shift+L

Configuration Panel

First Element Greater/Equal Target Index Highlight

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

Time Complexity

O(log N) search operations

Space Complexity

O(1) auxiliary variables
Conceptual Overview

Lower Bound returns the index of the first element in a sorted range that does not compare less than the target value (i.e. element >= target).

Algorithm Idea

Run binary search using bounds low = 0, high = N. If mid value >= target, shift high = mid, otherwise shift low = mid + 1.

Stable Sorting

N/A

In-place Memory

N/A

Source: CP-Algorithms search & sorting reference