Class SortedBinaryTree
Static members for ISortedBinaryTree<T> and ISortedBinaryTree<T, TCompare>.
Inheritance
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public static class SortedBinaryTree : object
Methods
| Improve this Doc View SourceContainsSift<T>(ISortedBinaryTree<T>, Func<T, CompareResult>)
Determines if the tree contains a value.
Declaration
public static bool ContainsSift<T>(this ISortedBinaryTree<T> tree, Func<T, CompareResult> sift)
Parameters
Type | Name | Description |
---|---|---|
ISortedBinaryTree<T> | tree | The tree to perfrom the contains check on. |
Func<T, CompareResult> | 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 |
---|---|
T | The type of values stored in this data structure. |
Stepper<T>(ISortedBinaryTree<T>, T, T, Action<T>)
Does an optimized step function (left to right) for sorted binary search trees.
Declaration
public static void Stepper<T>(this ISortedBinaryTree<T> tree, T minimum, T maximum, Action<T> step)
Parameters
Type | Name | Description |
---|---|---|
ISortedBinaryTree<T> | tree | The tree to traverse. |
T | minimum | The minimum step value. |
T | maximum | The maximum step value. |
Action<T> | step | The step function. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this data structure. |
Stepper<T, TStep>(ISortedBinaryTree<T>, T, T, TStep)
Does an optimized step function (left to right) for sorted binary search trees.
Declaration
public static void Stepper<T, TStep>(this ISortedBinaryTree<T> tree, T minimum, T maximum, TStep step = default(TStep))
where TStep : struct, IAction<T>
Parameters
Type | Name | Description |
---|---|---|
ISortedBinaryTree<T> | tree | The tree to traverse. |
T | minimum | The minimum step value. |
T | maximum | The maximum step value. |
TStep | step | The step function. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this data structure. |
TStep | The type of the step function. |
StepperBreak<T>(ISortedBinaryTree<T>, T, T, Func<T, StepStatus>)
Does an optimized step function (left to right) for sorted binary search trees.
Declaration
public static StepStatus StepperBreak<T>(this ISortedBinaryTree<T> tree, T minimum, T maximum, Func<T, StepStatus> step)
Parameters
Type | Name | Description |
---|---|---|
ISortedBinaryTree<T> | tree | The tree to traverse. |
T | minimum | The minimum step value. |
T | maximum | The maximum step value. |
Func<T, StepStatus> | step | The step function. |
Returns
Type | Description |
---|---|
StepStatus | The result status of the stepper function. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this data structure. |
StepperReverse<T>(ISortedBinaryTree<T>, T, T, Action<T>)
Does an optimized step function (right to left) for sorted binary search trees.
Declaration
public static void StepperReverse<T>(this ISortedBinaryTree<T> tree, T minimum, T maximum, Action<T> step)
Parameters
Type | Name | Description |
---|---|---|
ISortedBinaryTree<T> | tree | The tree to traverse. |
T | minimum | The minimum step value. |
T | maximum | The maximum step value. |
Action<T> | step | The step function. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this data structure. |
StepperReverse<T, TStep>(ISortedBinaryTree<T>, T, T, TStep)
Does an optimized step function (right to left) for sorted binary search trees.
Declaration
public static void StepperReverse<T, TStep>(this ISortedBinaryTree<T> tree, T minimum, T maximum, TStep step = default(TStep))
where TStep : struct, IAction<T>
Parameters
Type | Name | Description |
---|---|---|
ISortedBinaryTree<T> | tree | The tree to traverse. |
T | minimum | The minimum step value. |
T | maximum | The maximum step value. |
TStep | step | The step function. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this data structure. |
TStep | The type of the step function. |
StepperReverseBreak<T>(ISortedBinaryTree<T>, T, T, Func<T, StepStatus>)
Does an optimized step function (right to left) for sorted binary search trees.
Declaration
public static StepStatus StepperReverseBreak<T>(this ISortedBinaryTree<T> tree, T minimum, T maximum, Func<T, StepStatus> step)
Parameters
Type | Name | Description |
---|---|---|
ISortedBinaryTree<T> | tree | The tree to traverse. |
T | minimum | The minimum step value. |
T | maximum | The maximum step value. |
Func<T, StepStatus> | step | The step function. |
Returns
Type | Description |
---|---|
StepStatus | The result status of the stepper function. |
Type Parameters
Name | Description |
---|---|
T | The type of values stored in this data structure. |
TryGet<T>(ISortedBinaryTree<T>, Func<T, CompareResult>)
Tries to get a value.
Declaration
public static (bool Success, T Value, Exception? Exception) TryGet<T>(this ISortedBinaryTree<T> tree, Func<T, CompareResult> sift)
Parameters
Type | Name | Description |
---|---|---|
ISortedBinaryTree<T> | tree | The tree to perfrom the TryGet on. |
Func<T, CompareResult> | 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 |
---|---|
T | The type of values stored in this data structure. |
TryRemoveSift<T>(ISortedBinaryTree<T>, Func<T, CompareResult>)
Tries to remove a value.
Declaration
public static (bool Success, Exception? Exception) TryRemoveSift<T>(this ISortedBinaryTree<T> tree, Func<T, CompareResult> sift)
Parameters
Type | Name | Description |
---|---|---|
ISortedBinaryTree<T> | tree | The tree to perfrom the TryRemoveSift on. |
Func<T, CompareResult> | 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 |
---|---|
T | The type of values stored in this data structure. |