c++ - binary search a std:map -


using c++, if have n integers in std::map, possible efficiently search largest element smaller k in std::map ?

for example have {1, 3, 5, 6} , k 4 returned value should 3

i know std::map can search in log(n), if exact match.

use lower_bound , decrement returned iterator one.


Comments

Popular posts from this blog

ios - Change Storyboard View using Seague -

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -