BisectPy
Index
BisectPy.bisect_leftBisectPy.bisect_rightBisectPy.find_geBisectPy.find_gtBisectPy.find_leBisectPy.find_ltBisectPy.indexBisectPy.insort_leftBisectPy.insort_right
BisectPy.bisect_left — Functionbisect_left(a, x, lo = 1, hi = length(a) + 1)Return the index where to insert item x in array a, assuming a is in an non-decreasing order.
The return value i is such that all e in a[:(i - 1)] have e < x, and all e in a[i:] have e >= x. So if x already appears in the array, insert!(a, i, x) will insert just before the leftmost x already there.
Arguments
Optional args lo (default 1) and hi (default length(a) + 1) bound the slice of a to be searched.
Examples
julia> bisect_left([1, 2, 3, 4, 5], 3.5)
4
julia> bisect_left([1, 2, 3, 4, 5], 2)
2
julia> bisect_left([1, 2, 3, 3, 3, 5], 3)
3BisectPy.bisect_right — Functionbisect_right(a, x, lo = 1, hi = length(a) + 1)Return the index where to insert item x in array a, assuming a is in an non-decreasing order.
The return value i is such that all e in a[:(i - 1)] have e <= x, and all e in a[i:] have e > x. So if x already appears in the array, insert!(a, i, x) will insert just after the rightmost x already there.
Arguments
Optional args lo (default 1) and hi (default length(a) + 1) bound the slice of a to be searched.
Examples
julia> bisect_right([1, 2, 3, 4, 5], 3.5)
4
julia> bisect_right([1, 2, 3, 4, 5], 2)
3
julia> bisect_right([1, 2, 3, 3, 3, 5], 3)
6BisectPy.find_ge — Methodfind_ge(a, x)Find leftmost item greater than or equal to x in a.
BisectPy.find_gt — Methodfind_gt(a, x)Find leftmost value greater than x in a.
BisectPy.find_le — Methodfind_le(a, x)Find rightmost value less than or equal to x in a.
BisectPy.find_lt — Methodfind_lt(a, x)Find rightmost value less than x in a.
BisectPy.index — Methodindex(a, x)Locate the leftmost value exactly equal to x in a.
BisectPy.insort_left — Functioninsort_left(a, x, lo = 1, hi = nothing)Insert item x in array a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the left of the leftmost x. Optional args lo (default 1) and hi (default length(a)) bound the slice of a to be searched.
BisectPy.insort_right — Functioninsort_right(a, x, lo = 1, hi = nothing)Insert item x in array a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the right of the rightmost x. Optional args lo (default 1) and hi (default length(a)) bound the slice of a to be searched.