Skip to content

CRedBlackTree<T>

CRedBlackTree

CRedBlackTree is a generic class that implements the ICollection interface.

Description

The CRedBlackTree class is an implementation of a dynamic red–black tree whose nodes store T type data. The class provides basic methods to work with red–black trees, such as to add, delete, search for the maximum and minimum value, and more.

Declaration

template<typename T>
   class CRedBlackTree : public ICollection<T>

Header

#include <Generic\RedBlackTree.mqh>

Inheritance Hierarchy

ICollection

CRedBlackTree

Class Methods

MethodDescription
AddAdds an element to a red–black tree
RootReturns a pointer to the root of the red–black tree
CountReturns the number of elements in the red–black tree
ContainsDetermines whether the red–black tree contains an element with the specified value
ComparerReturns a pointer to the IComparer interface used to organize a red–black tree
TryGetMinGets the minimum element of a red–black tree
TryGetMaxGets the maximum element of a red–black tree
CopyToCopies all elements of a red–black tree to the specified array starting at the specified index
ClearRemoves all elements from a red–black tree
RemoveRemoves the occurrence of the specified element from a red–black tree
RemoveMinRemoves an element with the minimum value from a red–black tree
RemoveMaxRemoves an element with the maximum value from a red–black tree
FindSearches for the occurrence of a specified value in a red–black tree
FindMaxSearches for an element with the maximum value in a red–black tree
FindMinSearches for an element with the minimum value in a red–black tree
Last updated on