lower_bound() ,up_bound()
时间: 2023-10-14 19:01:23 浏览: 99
lower-bound函数2.zip
lower_bound()和up_bound()是STL中用于二分查找的函数。它们都适用于有序区间。lower_bound()函数返回被查序列中第一个大于等于查找值的指针,而up_bound()函数返回被查序列中第一个大于查找值的指针。使用lower_bound()函数时,可以通过迭代器来获得找到的元素的值。例如,通过lower_bound查找大于等于8的数,可以得到一个迭代器,通过迭代器可以获得找到的值。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [c++ Algorithm库中lower_bound和upper_bound的返回值及各种情况](https://blog.csdn.net/New_exp/article/details/129050923)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* [C++ 的 upper_bound 和 lower_bound 函数](https://blog.csdn.net/m0_51913750/article/details/128364536)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文