表示多组连续实数的数据结构 [英] Data Structure for representing several sets of continuous real numbers
本文介绍了表示多组连续实数的数据结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
如何代表一组实数的多个子集?
问题是,例如,我想删除范围为[[0,2 * pi)]的实数部分,删除后,我将得到如下内容:
结果集= [0,0.1] U [.2,2.65] U [2.66,2.86] U ... U [3.0,3.1]
实际上,结果集由几个不重叠的子集组成(我们不知道这些子集的确切数量.它们可能多达200个).
Hi!
How could I represent multiple subsets of a set of real numbers?
The problem is that,I want to remove some parts of real numbers in range : [0,2*pi) for example,after removal I will have s.th like this:
Result set = [0,0.1] U [.2,2.65] U [2.66,2.86] U ... U [3.0,3.1]
in fact the result set,consists of several non-overlapping subsets(we don''t know the exact count of these subsets.may be they are up to 200).
how could I implement "union" and "subtraction" and "overlapping" operations?
推荐答案
您可以使用 ^ ]代表集合.
您说对了,这对于连续的设置是行不通的.似乎您可能需要酿造自己的Range<T>
类.
/ravi
You can useHashSet<t></t>
[^] to represent sets.
You''re right, this won''t work for a continuous set. Seems you may have to brew your ownRange<T>
class.
/ravi
这篇关于表示多组连续实数的数据结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文