![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
STL
吾说
计算机科学与技术专业在读学生
展开
-
二分查找函数
upper_bound 和lower_bound是二分查找 不同之处在于lower_bound返回的是第一个大于等于某个数的位置,适合求一个数组里有多少个比该数小的 a={1,2,2,3,3,4,4,5,5,}(下标从0开始) b={1,2,2,3,3,5,5,,6,6} 如:查找比4小的数字的个数 num=lower_bound(a,a+n,4)-a;返回num=5;//指针定位到第一个...原创 2018-08-03 16:20:07 · 492 阅读 · 0 评论 -
STL之 nth_element
nth_element(d,d+k,d+n); ...原创 2018-08-05 16:43:03 · 104 阅读 · 0 评论