- #36
CRGreathouse
Science Advisor
Homework Helper
- 2,845
- 0
Got it. So yes, you really don't want the be expressing things in first-order logic directly -- you want efficient data structures resembling the set-theoretic objects.
An important consideration here is how you want to use things. For example, here are two ways to code a multiset:
* As an expandable array, containing multiple copies of an object if it's in the multiset more than once.
* As a fixed-length unsigned integer array, with each uint representing the number of times the element is in the multiset.
The second is good when you have many copies of each element and few distinct elements. The first is good when you have few copies of each element or many distinct objects.
An important consideration here is how you want to use things. For example, here are two ways to code a multiset:
* As an expandable array, containing multiple copies of an object if it's in the multiset more than once.
* As a fixed-length unsigned integer array, with each uint representing the number of times the element is in the multiset.
The second is good when you have many copies of each element and few distinct elements. The first is good when you have few copies of each element or many distinct objects.