New to Telerik UI for WPFStart a free 30-day trial

Base implementation of the ISearchTree<T> interface.

Definition

Namespace:Telerik.Windows.Diagrams.Core

Assembly:Telerik.Windows.Diagrams.Core.dll

Type Parameters:

T

The data type contained in this collection.

Syntax:

C#
public abstract class BinarySearchTreeBase<T> : ISearchTree<T>, ICollection<T>, IEnumerable<T>, IEnumerable

Inheritance: objectBinarySearchTreeBase<T>

Derived Classes: RedBlackTree<T>

Implements: ICollection<T>IEnumerableIEnumerable<T>ISearchTree<T>

Constructors

Initializes a new instance of the BinarySearchTreeBase<T> class.

C#
protected BinarySearchTreeBase()

Initializes a new instance of the BinarySearchTreeBase<T> class.

C#
protected BinarySearchTreeBase(Comparison<T> comparison)
Parameters:comparisonComparison<T>

The comparison.

Initializes a new instance of the BinarySearchTreeBase<T> class.

C#
protected BinarySearchTreeBase(IComparer<T> comparer)
Parameters:comparerIComparer<T>

The comparer to use when comparing items.

Exceptions:

ArgumentNullException

comparer is a null reference (Nothing in Visual Basic).

Properties

Gets the comparer.

C#
public IComparer<T> Comparer { get; }
Property Value:

The comparer.

Gets the count.

C#
public int Count { get; }

Implements: ICollection<T>.Count

Gets the height.

C#
public int Height { get; }

Gets a value indicating whether this instance is empty.

C#
public bool IsEmpty { get; }
Property Value:

true if this instance is empty; otherwise, false.

Gets a value indicating whether this instance is read only.

C#
public bool IsReadOnly { get; }
Property Value:

true if this instance is read only; otherwise, false.

Implements: ICollection<T>.IsReadOnly

Gets the maximum.

C#
public virtual T Maximum { get; }

Implements: ISearchTree<T>.Maximum

Gets the minimum.

C#
public virtual T Minimum { get; }

Implements: ISearchTree<T>.Minimum

Gets or sets the binary tree.

C#
protected BinaryTree<T> Tree { get; set; }

Methods

Adds the specified item.

C#
public void Add(T item)
Parameters:itemT

The item.

Implements: ICollection<T>.Add(T)

Adds the item.

C#
protected abstract void AddItem(T item)
Parameters:itemT

The item.

Clears this instance.

C#
public void Clear()

Implements: ICollection<T>.Clear()

Clears all the objects in this instance.

C#
protected virtual void ClearItems()
Remarks:

Notes to Inheritors: Derived classes can override this method to change the behavior of the Clear() method.

Determines whether the item is in this tree.

C#
public virtual bool Contains(T item)
Parameters:itemT

The item.

Returns:

bool

true if [contains] [the specified item]; otherwise, false.

Implements: ICollection<T>.Contains(T)

Copies to.

C#
public void CopyTo(T[] array, int arrayIndex)
Parameters:arrayT[]

The array.

arrayIndexint

Index of the array.

Implements: ICollection<T>.CopyTo(T[], int)

Depth first search traversal.

C#
public void DepthFirstTraversal(IVisitor<T> visitor)
Parameters:visitorIVisitor<T>

The visitor.

Implements: ISearchTree<T>.DepthFirstTraversal(IVisitor<T>)

Find the maximum node.

C#
protected BinaryTree<T> FindMaximumNode()
Returns:

BinaryTree<T>

The maximum node.

Finds the maximum node.

C#
protected static BinaryTree<T> FindMaximumNode(BinaryTree<T> startNode)
Parameters:startNodeBinaryTree<T>

The start node.

Returns:

BinaryTree<T>

The maximum node below this node.

Find the minimum node.

C#
protected BinaryTree<T> FindMinimumNode()
Returns:

BinaryTree<T>

The minimum node.

Finds the minimum node.

C#
protected static BinaryTree<T> FindMinimumNode(BinaryTree<T> startNode)
Parameters:startNodeBinaryTree<T>

The start node.

Returns:

BinaryTree<T>

The minimum node below this node.

Finds the node containing the specified data key.

C#
protected virtual BinaryTree<T> FindNode(T item)
Parameters:itemT

The item.

Returns:

BinaryTree<T>

The node with the specified key if found. If the key is not in the tree, this method returns null.

Finds the node that matches the custom delegate.

C#
protected virtual BinaryTree<T> FindNode<TSearch>(TSearch value, BinarySearchTreeBase<T>.CustomComparison<TSearch> customComparison)
Parameters:valueTSearch

The value.

customComparisonBinarySearchTreeBase<T>.CustomComparison<TSearch>

The custom comparison.

Returns:

BinaryTree<T>

The item if found, else null.

Returns an enumerator that iterates through the collection.

C#
public IEnumerator<T> GetEnumerator()
Returns:

IEnumerator<T>

A IEnumerator<T> that can be used to iterate through the collection.

Implements: IEnumerable<T>.GetEnumerator()

Gets the ordered enumerator.

C#
public IEnumerator<T> GetOrderedEnumerator()
Returns:

IEnumerator<T>

Implements: ISearchTree<T>.GetOrderedEnumerator()

Removes the specified item.

C#
public bool Remove(T item)
Parameters:itemT

The item.

Returns:

bool

Implements: ICollection<T>.Remove(T)

Removes the item from the tree.

C#
protected abstract bool RemoveItem(T item)
Parameters:itemT

The item to remove.

Returns:

bool

An indication of whether the item has been removed from the tree.