pub fn bisect<T: Ord>(data: &[T], x: &T) -> usizeExpand description
Returns the insertion point for x in a sorted slice to maintain sorted order.
If x is already present, returns the index after any existing entries.
This is equivalent to bisect_right.
ยงExample
use d3rs::array::bisect;
let data = vec![1, 2, 3, 5, 8, 13];
assert_eq!(bisect(&data, &4), 3);
assert_eq!(bisect(&data, &5), 4); // After existing 5