集合的有效交集?

编程入门 行业动态 更新时间:2024-10-25 13:31:13
本文介绍了集合的有效交集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想知道最有效的方法是什么.

I'm wondering what the most efficient way of doing this is.

我有从 2 个地方收集的积分.

I have points that I gather from 2 places.

我只对两个地方的共同点感兴趣.

I am only interested in the points which are common to both places.

我的计划是有 3 个 std::set .首先我将区域A的点加到集合A中,然后从B点到集合B,让集合C成为两个集合的交集.

My plan is to have 3 std::set<Point> . First I will add in the points from area A,into set A then points from B into set B and let set C be the intersection of both sets.

然而,我想知道是否有更好的方法来做到这一点,可能涉及更少的集合?

However, I'm wondering if there is a better way of doing this that involves maybe less sets?

谢谢

推荐答案

你的问题太普遍了,甚至有一个(以明显的方式命名)标准算法set_intersection()供您使用.

Your problem is so common that there even is a (named in an obvious way) standard algorithm set_intersection() for you to use.

更多推荐

集合的有效交集?

本文发布于:2023-11-29 18:29:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647241.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!