12 lines
372 B
Org Mode
12 lines
372 B
Org Mode
|
|
#+ANKI_DECK: study_deck_02
|
||
|
|
* When to use lower_bound vs binary_search :cpp:binary-search:algorithm:retrieval::recognition:
|
||
|
|
:PROPERTIES:
|
||
|
|
:END:
|
||
|
|
|
||
|
|
** Front
|
||
|
|
When should you use ~std::lower_bound~ instead of ~std::binary_search~?
|
||
|
|
|
||
|
|
** Back
|
||
|
|
Use ~lower_bound~ when you need the *position/index* of the element.
|
||
|
|
Use ~binary_search~ when you only need to know *if it exists* (bool).
|