c# - .NET 4.0 中是否有内置的二叉搜索树?

标签 c# .net binary-tree

.NET 4.0 中是否有内置的二叉搜索树,或者我是否需要从头开始构建这种抽象数据类型?

编辑

这是专门针对二叉搜索树的,而不是一般的抽象数据类型“树”。

最佳答案

我认为 SortedSet<T> System.Collections.Generic 中上课正是您要找的。

来自 this CodeProject article :

It is implemented using a self-balancing red-black tree that gives a performance complexity of O(log n) for insert, delete, and lookup. It is used to keep the elements in sorted order, to get the subset of elements in a particular range, or to get the Min or Max element of the set.

源代码https://github.com/dotnet/corefx/blob/master/src/System.Collections/src/System/Collections/Generic/SortedSet.cs

关于c# - .NET 4.0 中是否有内置的二叉搜索树?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3262947/

相关文章:

java - TreeSet操作的复杂性

tree - 在二叉树中查找距给定节点最近的叶节点

c# - 为什么模型绑定(bind)器需要一个空的构造函数

c# - 具有 MediatR 的 CQRS 和命令的可重用性

.net - Objective-C 类别和 .NET 扩展方法之间存在哪些差异?

c# - 实现平衡二叉搜索树?

c# - 在模拟用户下运行的 FileSystemWatcher

c# - 压缩/解压缩音频数据

C# 简化并可能概括了我的对象克隆方法

c# - 带有 byte[] 字段作为存储过程参数的 DataTable