为什么没有树< T>在.NET类?LT、GT、NET

由网友(薄荷味的夏天)分享简介:在.NET的基类库有一些优秀的数据结构集合(列表,队列,栈,字典),但奇怪的是它不包含任何数据结构二叉树。这对于某些算法,例如那些利用不同的遍历路径优势的非常有用的结构。我在寻找一个正确书写,免费实现。The base class library in .NET has some excellent data str...

在.NET的基类库有一些优秀的数据结构集合(列表,队列,栈,字典),但奇怪的是它不包含任何数据结构二叉树。这对于某些算法,例如那些利用不同的遍历路径优势的非常有用的结构。我在寻找一个正确书写,免费实现。

The base class library in .NET has some excellent data structures for collections (List, Queue, Stack, Dictionary), but oddly enough it does not contain any data structures for binary trees. This is a terribly useful structure for certain algorithms, such as those that take advantage of different traversal paths. I'm looking for a correctly written, free implementation.

难道我只是盲目的,并没有找到它......它是在BCL埋的地方?如果不是这样,有人可以推荐一个免费或开放源码C#/。NET二进制树库? preferably一个使用泛型。

Am I simply blind, and not finding it... is it buried somewhere in the BCL? If not, can someone recommend a free or open-source C#/.NET library for binary trees? Preferably one that employs generics.

编辑::要澄清我在寻找什么。我不感兴趣,在内部使用树有序字典集合。我在一个二叉树真正感兴趣 - 一个公开其结构,这样就可以做的事情一样提取子树,或者在节点上进行定位后遍历。理想的情况是这样的类可被扩展,以提供专门的树木(即红/黑,AVL,平衡等)的行为。

To clarify what I'm looking for. I'm not interested in ordered dictionary collections that internally use a tree. I'm actually interested in a binary tree - one that exposes its structure so that you can do things like extract subtrees, or perform post-fix traversal on the nodes. Ideally such a class could be extended to provide the behaviors of specialized trees (ie. Red/Black, AVL, Balanced, etc).

推荐答案

您说的没错,没有什么在BCL。我怀疑这是因为是否使用一棵树的选择是一个典型的实现细节,是否则非常规的方式来访问数据。也就是说,你不说,二进制搜索的元素#37;相反,你说:给我拿件#37。

You're right, there's nothing in the BCL. I suspect this is because the choice of whether to use a tree is typically an implementation detail and is otherwise an unconventional way to access data. That is, you don't say, "binary-search-for element #37"; instead, you say, "get me element #37".

但你有没有采取一起来看看 C5 ?这是超级方便,他们有几个树的实现( 1 , 2 ,的

阅读全文

相关推荐

最新文章