Skip to main content

insert_bid

Function insert_bid 

Source
pub fn insert_bid(levels: &mut Vec<PriceLevel>, level: PriceLevel)
Expand description

Insert a price level into a bid-sorted (descending) list. Binary-search for the insert position (O(log n)), then Vec::insert (O(n) memcpy shift on average). Net O(log n + n) per op vs the old push+sort’s O(n log n). Equal-price entries go AFTER existing entries.