15 lines
384 B
Org Mode
15 lines
384 B
Org Mode
|
|
#+ANKI_DECK: study_deck_02
|
||
|
|
* std::lower_bound: find position of element :cpp:binary-search:algorithm:retrieval::recognition:
|
||
|
|
:PROPERTIES:
|
||
|
|
:END:
|
||
|
|
|
||
|
|
** Front
|
||
|
|
What does ~std::lower_bound~ return?
|
||
|
|
|
||
|
|
** Back
|
||
|
|
An iterator to the first element *>=* the given value. Returns ~end()~ if no such element exists.
|
||
|
|
|
||
|
|
#+begin_src cpp
|
||
|
|
auto it = std::lower_bound(vec.begin(), vec.end(), value);
|
||
|
|
#+end_src
|