C/C++
并集 标签描述

CSTL中常见集合算法交集、并集、差集 1.集合概述 在STL中,常用的集合类包括std::set、std::vector、std::unordered_set等。以std::set为例进行这些算法的讲解。 2.交集(Intersection) 定义:交集是指两个集合中共同存在的元素的集合。 算法:使用std::set_intersection函数实现。 std::set<int>set1={1,2,3,4,5}; std::set<int>set2={3,4,5,6,7}; std::set<int>intersect; std::set_interse...