常用STL函数用法

C++标准库总结

algorithm常用函数:("#"有该函数的实现)

非修改性序列操作 

for_each遍历

find和find_if

count和count_if

mismatch

equal

search和search_n

is_permutation 是否是同一个排列,判断两个集合是否含有相同的元素#

修改性的序列操作 

copy,copy_n,copy_if

transform

replace,replace_if,replace_copy,replace_copy_if

fill,fill_n

generate,generate_n

remove,remove_if

unique  去除相邻重复元素

reverse(t1.begin(),t1.end());//反转

rotate(t1.begin(),t1.begin()+4,t1.end());//循环移动

shuffle,random_shuffle 随机移动元素


划分:

partition#

is_partitioned#

sort#

二叉树:

lower_bound与upper_bound#


归并(已排序集合):

merge#

set_union,set_intersection,set_difference合集、交集、差集#


堆:

make_heap,push_heap,pop_heap,sort_heap(以最大的K个数为例)

其他:

next_permutation#



正在整理中......

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值