Using Set Theory with arrays in programming [closed]
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.
精彩评论