![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
实用函数和算法
「已注销」
这个作者很懒,什么都没留下…
展开
-
STL中二分查找函数——binary_search__lower_bound__upper_bound__equal_range
以下函数均需配合头文件< algorithm>和sort函数排序后使用lower_boundint lower_bound(start,end,num);返回值是int类型,返回的是一个指针,意义是在[start,end)范围内第一次遇到大于或等于num的下标。upper_boundint upper_bound(start,end,num);返回值是int类型,返...原创 2020-02-06 00:10:39 · 94 阅读 · 0 评论 -
lowbit函数
lowbit函数——返回二进制数的最后一位1,在返回时附带其后面的0举例:x=1010 —> lowbit(x)=10 ==2x=101000 —> lowbit(x)=1000 ==8x=11111111000000 —> lowbit(x)=1000000 ==64即返回的数都是一个2的多少次方实现:由于数在计算机里以补码的方式储存,运用...原创 2020-02-06 00:10:13 · 421 阅读 · 0 评论 -
C++ STL学习笔记
STL是个宝由于C++ STL的开放,代替了那些需要老老实实写结构体来实现堆栈二叉树等数据结构的C等语言,很多算法不需要自己来实现了vectorpairstringqueue,priority_queuestackdequeset,map,multiset,multimapunordered_set,unordered_map,unordered_multiset,unorde...原创 2020-02-06 00:03:45 · 114 阅读 · 0 评论