Is there a built-in binary search tree in .NET 4.0, or do I need to build this abstract data type from scratch?
This is about the binary search tree specifically, and not abstract data type "trees" in general.
I think the SortedSet<T>
class in System.Collections.Generic
is what you're looking for.
From 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.