2021年8月18日
摘要: 1 //常用集合算法 2 //set_intersection //求俩个容器的交集 3 //set_union //求两个容器的并集 4 //set_difference //求两个容器的差集 5 6 #include<iostream> 7 #include<vector> 8 #include 阅读全文
posted @ 2021-08-18 20:36 Bytezero! 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 1 //常用算术生成算法 //#include<numeric> accumulate 2 //fill //向容器中填充指定的元素 3 #include<iostream> 4 #include<vector> 5 #include<numeric> 6 #include<algorithm> 7 阅读全文
posted @ 2021-08-18 19:41 Bytezero! 阅读(70) 评论(0) 推荐(0) 编辑
摘要: //常用拷贝和替换算法 //copy //replace 将指定区间范围内的旧元素修改为新元素 //replace_if(满足条件的元素,替换指定的元素) //swap 互换两个容器的元素 #include<iostream> #include<vector> #include<algorithm> 阅读全文
posted @ 2021-08-18 19:21 Bytezero! 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1 //常用排序算法 sort //打乱 random_shuffle 2 //merge 两个容器元素合并,并储存到另一容器中(相同的有序序列) 3 //reverse 将容器内的元素进行反转 4 5 #include<iostream> 6 #include<string> 7 #include 阅读全文
posted @ 2021-08-18 15:43 Bytezero! 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 1 //按条件统计元素个数 2 //count_if 3 4 #include <iostream> 5 #include<string> 6 #include<vector> 7 #include<algorithm> 8 9 using namespace std; 10 11 class Gr 阅读全文
posted @ 2021-08-18 14:48 Bytezero! 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 1 //统计元素个数 2 3 #include<iostream> 4 #include<string> 5 #include<vector> 6 #include<algorithm> 7 using namespace std; 8 9 //统计内置数据类型 10 void test01() 1 阅读全文
posted @ 2021-08-18 14:27 Bytezero! 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1 //常用算法 binary_serach 2 //查找指定的元素 3 //无序序列中不可用 4 5 6 #include<iostream> 7 #include<algorithm> 8 #include<vector> 9 10 using namespace std; 11 12 void 阅读全文
posted @ 2021-08-18 10:59 Bytezero! 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 1 //常用算法 adjacent_find 2 //查找相邻的重复元素 3 #include<iostream> 4 #include<string> 5 #include<algorithm> 6 #include<vector> 7 8 using namespace std; 9 10 vo 阅读全文
posted @ 2021-08-18 10:46 Bytezero! 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 1 //常用查找算法 find_if 2 #include<iostream> 3 #include<string> 4 #include<vector> 5 #include<algorithm> 6 7 using namespace std; 8 9 //内置数据类型 10 11 class 阅读全文
posted @ 2021-08-18 10:37 Bytezero! 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 1 //常用查找算法 find 2 #include<iostream> 3 #include<algorithm> 4 #include<functional> 5 #include<vector> 6 #include<string> 7 #include<map> 8 9 using name 阅读全文
posted @ 2021-08-18 09:15 Bytezero! 阅读(175) 评论(0) 推荐(0) 编辑