在编程中使用集合论和数组

发布于 2024-11-02 18:12:58 字数 237 浏览 1 评论 0原文

我想知道任何编程语言中是否都有允许您测试集合论的函数。例如,可以在大型集合上执行组合的库或一系列不错的算法。

我不需要基本的推送/弹出功能,我想知道哪些编程语言存在用于 UNION CONCAT INTERSECTIONS 和 Compliments 等函数的库,以及 100k+ 元素集的子集比较。

我知道这听起来像一个数学问题......也许不是,但我更多地寻找一种旨在快速处理大型集合的编程语言,因为我知道我的算法会很慢。

I was wondering if there are functions in any programming languages that allow you to test set theory. For example a library or series of decent algorithms that can perform Combinatorics on large sets.

I don't need basic push/pop I would like to know for what programming languages do libraries exist for functions like UNION CONCAT INTERSECTIONS and Compliments, and comparison of sub sets for 100k+ element sets.

I know this sounds like a math question... maybe not but I am more looking for a Programming language that is designed to handle large sets quickly, because I know my algorithms will be slow.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不气馁 2024-11-09 18:12:58

标准 Python set type 提供了这些操作。不能保证速度符合您的需要,因为您没有说明您的性能要求。

The standard Python set type provides these operations. No guarantees that the speed will be what you need, since you haven't stated your performance requirements.

好菇凉咱不稀罕他 2024-11-09 18:12:58
  • LINQ
  • 函数式语言
  • R

....

  • LINQ
  • Functional languages
  • R

....

征棹 2024-11-09 18:12:58

你可以使用Scala,它对集合有很好的支持!例如:

val set1 = Set(1,2,3,4)
val set2 = Set(3,4,5,6)
set1 & set2 //gives intersection
set1 intersect set2 //also possible to write
set1 | set2 //or set1 union set2 gives union
set1 &~ set2 //or set1 diff set2 gives difference

还有适合特定问题的不同实现,它们是 SortedSet、BitSet、HashSet 等。

You can use Scala, it has great support of sets! For example:

val set1 = Set(1,2,3,4)
val set2 = Set(3,4,5,6)
set1 & set2 //gives intersection
set1 intersect set2 //also possible to write
set1 | set2 //or set1 union set2 gives union
set1 &~ set2 //or set1 diff set2 gives difference

Also different implementations that good for particular issues, they are SortedSet, BitSet, HashSet and etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文