STL学习 sort,lower_bound/upper_bound函数
刚学stl,总结下。两个函数都是基于二分查找的方法,所以在使用这两个函数前,得将序列排序为有序序列。排序就可以利用sort函数。sort(begin,end,条件)如果不写条件,默认是从小到大排序。函数功能是:从begin开始(包括begin)到end-1(包括end-1)按条件进行排序。如果从大到小排序,可以写个函数,将其函数名放在条件处。bool big(int a,int b)...
原创
2018-12-04 17:53:23 ·
555 阅读 ·
0 评论