开发者

Using Set Theory with arrays in programming [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

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 INTER开发者_开发知识库SECTIONS 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.


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.


  • LINQ
  • Functional languages
  • R

....


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜