Class RedBlackTree<T>
- Namespace
- AlgorithmsSW.SearchTrees
- Assembly
- AlgorithmsSW.dll
public class RedBlackTree<T> : IBinarySearchTree<T>
Type Parameters
T
- Inheritance
-
RedBlackTree<T>
- Implements
-
- Inherited Members
-
- Extension Methods
-
Constructors
RedBlackTree(IComparer<T>)
public RedBlackTree(IComparer<T> comparer)
Parameters
comparer
IComparer<T>
Properties
Count
public int Count { get; }
Property Value
- int
IsEmpty
public bool IsEmpty { get; }
Property Value
- bool
IsSingleton
public bool IsSingleton { get; }
Property Value
- bool
NodesInOrder
public IEnumerable<RedBlackTree<T>.Node> NodesInOrder { get; }
Property Value
- IEnumerable<RedBlackTree<T>.Node>
NodesLevelOrder
public IEnumerable<RedBlackTree<T>.Node> NodesLevelOrder { get; }
Property Value
- IEnumerable<RedBlackTree<T>.Node>
NodesPostOrder
public IEnumerable<RedBlackTree<T>.Node> NodesPostOrder { get; }
Property Value
- IEnumerable<RedBlackTree<T>.Node>
NodesPreOrder
public IEnumerable<RedBlackTree<T>.Node> NodesPreOrder { get; }
Property Value
- IEnumerable<RedBlackTree<T>.Node>
Root
public RedBlackTree<T>.Node? Root { get; }
Property Value
- RedBlackTree<T>.Node
Methods
Add(T)
Parameters
item
T
CountNodesSmallerThan(T)
public int CountNodesSmallerThan(T item)
Parameters
item
T
Returns
- int
GetMaxNode()
public RedBlackTree<T>.Node GetMaxNode()
Returns
- RedBlackTree<T>.Node
GetMinNode()
public RedBlackTree<T>.Node GetMinNode()
Returns
- RedBlackTree<T>.Node
Height()
Returns
- int
LargestKeyLessThanOrEqualTo(T)
public RedBlackTree<T>.Node? LargestKeyLessThanOrEqualTo(T key)
Parameters
key
T
Returns
- RedBlackTree<T>.Node
NextNodeInOrder(Node)
public RedBlackTree<T>.Node? NextNodeInOrder(RedBlackTree<T>.Node node)
Parameters
node
RedBlackTree<T>.Node
Returns
- RedBlackTree<T>.Node
Range(T, T)
public IEnumerable<RedBlackTree<T>.Node> Range(T start, T end)
Parameters
start
T
end
T
Returns
- IEnumerable<RedBlackTree<T>.Node>
Remove(T)
public void Remove(T key)
Parameters
key
T
RemoveMaxNode()
public RedBlackTree<T>.Node RemoveMaxNode()
Returns
- RedBlackTree<T>.Node
RemoveMinNode()
public RedBlackTree<T>.Node RemoveMinNode()
Returns
- RedBlackTree<T>.Node
SmallestKeyGreaterThanOrEqualTo(T)
public RedBlackTree<T>.Node? SmallestKeyGreaterThanOrEqualTo(T key)
Parameters
key
T
Returns
- RedBlackTree<T>.Node
TryFindNode(T, out INode<T>)
public bool TryFindNode(T item, out INode<T> node)
Parameters
item
T
node
INode<T>
Returns
- bool