Show / Hide Table of Contents

Class AvlTreeLinked<T, TCompare>

A self-sorting binary tree based on the heights of each node.

Inheritance
System.Object
AvlTreeLinked<T, TCompare>
Implements
IAvlTree<T, TCompare>
IAvlTree<T>
ISortedBinaryTree<T, TCompare>
ISortedBinaryTree<T>
IDataStructure<T>
ISteppable<T>
System.Collections.Generic.IEnumerable<T>
DataStructure.IAddable<T>
DataStructure.IRemovable<T>
DataStructure.ICountable
DataStructure.IClearable
DataStructure.IAuditable<T>
DataStructure.IComparing<T, TCompare>
ICloneable<AvlTreeLinked<T, TCompare>>
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public class AvlTreeLinked<T, TCompare> : object, IAvlTree<T, TCompare>, IAvlTree<T>, ISortedBinaryTree<T, TCompare>, ISortedBinaryTree<T>, IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.IAddable<T>, DataStructure.IRemovable<T>, DataStructure.ICountable, DataStructure.IClearable, DataStructure.IAuditable<T>, DataStructure.IComparing<T, TCompare>, ICloneable<AvlTreeLinked<T, TCompare>> where TCompare : struct, IFunc<T, T, CompareResult>
Type Parameters
Name Description
T

The type of values stored in this data structure.

TCompare

The type that is comparing T values.

Constructors

| Improve this Doc View Source

AvlTreeLinked(TCompare)

Constructs an AVL Tree.

Declaration
public AvlTreeLinked(TCompare compare = default(TCompare))
Parameters
Type Name Description
TCompare compare

The comparison function for sorting T values.

Properties

| Improve this Doc View Source

Compare

Gets the value of the comparer that is comparing T values.

Declaration
public TCompare Compare { get; }
Property Value
Type Description
TCompare
| Improve this Doc View Source

Count

Gets the current count of the data structure.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

CurrentGreatest

Gets the current greated value in the tree.

Declaration
public T CurrentGreatest { get; }
Property Value
Type Description
T
| Improve this Doc View Source

CurrentLeast

Gets the current least value in the tree.

Declaration
public T CurrentLeast { get; }
Property Value
Type Description
T

Methods

| Improve this Doc View Source

Clear()

Returns the data structure to an empty state.

Declaration
public void Clear()
| Improve this Doc View Source

Clone()

Clones a T.

Declaration
public AvlTreeLinked<T, TCompare> Clone()
Returns
Type Description
AvlTreeLinked<T, TCompare>

A clone of the T.

| Improve this Doc View Source

Contains(T)

Checks if the data structure contains a value.

Declaration
public bool Contains(T value)
Parameters
Type Name Description
T value

The value to look for in the data structure.

Returns
Type Description
System.Boolean

True if the value exists in the data structure. False if not.

| Improve this Doc View Source

ContainsSift<TSift>(TSift)

Determines if the tree contains a value.

Declaration
public bool ContainsSift<TSift>(TSift sift = default(TSift))
    where TSift : struct, IFunc<T, CompareResult>
Parameters
Type Name Description
TSift sift

The sifting function that respects the sorting of the tree.

Returns
Type Description
System.Boolean

True if the value is in the tree or false if not.

Type Parameters
Name Description
TSift

The type of the sifting function.

| Improve this Doc View Source

TryAdd(T)

Tries to add a value to a data structure.

Declaration
public (bool Success, Exception? Exception) TryAdd(T value)
Parameters
Type Name Description
T value

The value to add to the data structure.

Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>

True if the value was added or false if not.

| Improve this Doc View Source

TryGet<TSift>(TSift)

Tries to get a value.

Declaration
public (bool Success, T Value, Exception? Exception) TryGet<TSift>(TSift sift = default(TSift))
    where TSift : struct, IFunc<T, CompareResult>
Parameters
Type Name Description
TSift sift

The sifting function that respects the sorting of the tree.

Returns
Type Description
System.ValueTuple<System.Boolean, T, System.Nullable<Exception>>

True if the value was found or false if not.

Type Parameters
Name Description
TSift

The type of the sifting function.

| Improve this Doc View Source

TryRemove(T)

Tries to remove a value.

Declaration
public (bool Success, Exception? Exception) TryRemove(T value)
Parameters
Type Name Description
T value

The value to remove.

Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>

True if the value was removed or false if not.

| Improve this Doc View Source

TryRemoveSift<TSift>(TSift)

Tries to remove a value.

Declaration
public (bool Success, Exception? Exception) TryRemoveSift<TSift>(TSift sift = default(TSift))
    where TSift : struct, IFunc<T, CompareResult>
Parameters
Type Name Description
TSift sift

The sifting function that respects the sorting of the tree.

Returns
Type Description
System.ValueTuple<System.Boolean, System.Nullable<Exception>>

True if the remove succeeded or false if not.

Type Parameters
Name Description
TSift

The type of the sifting function.

Implements

IAvlTree<T, TCompare>
IAvlTree<T>
ISortedBinaryTree<T, TCompare>
ISortedBinaryTree<T>
IDataStructure<T>
ISteppable<T>
System.Collections.Generic.IEnumerable<>
DataStructure.IAddable<T>
DataStructure.IRemovable<T>
DataStructure.ICountable
DataStructure.IClearable
DataStructure.IAuditable<T>
DataStructure.IComparing<T, TCompare>
ICloneable<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX