Class TreapTree<T>
A treap tree implementation.
Assembly: Advanced.Algorithms.dll
Syntax
public class TreapTree<T> : IEnumerable<T>, IEnumerable where T : IComparable
Type Parameters
Constructors
TreapTree()
Declaration
TreapTree(IEnumerable<T>)
Initialize the BST with given sorted keys.
Time complexity: O(n).
Declaration
public TreapTree(IEnumerable<T> sortedCollection)
Parameters
| Type |
Name |
Description |
| IEnumerable<T> |
sortedCollection |
The initial sorted collection.
|
Properties
Count
Declaration
public int Count { get; }
Property Value
Methods
AsEnumerableDesc()
Declaration
public IEnumerable<T> AsEnumerableDesc()
Returns
Delete(T)
Time complexity: O(log(n))
Declaration
public void Delete(T value)
Parameters
| Type |
Name |
Description |
| T |
value |
|
ElementAt(Int32)
Time complexity: O(log(n))
Declaration
public T ElementAt(int index)
Parameters
| Type |
Name |
Description |
| Int32 |
index |
|
Returns
FindMax()
Time complexity: O(log(n))
Declaration
Returns
FindMin()
Time complexity: O(log(n))
Declaration
Returns
GetEnumerator()
Declaration
public IEnumerator<T> GetEnumerator()
Returns
GetEnumeratorDesc()
Declaration
public IEnumerator<T> GetEnumeratorDesc()
Returns
HasItem(T)
Time complexity: O(log(n))
Declaration
public bool HasItem(T value)
Parameters
| Type |
Name |
Description |
| T |
value |
|
Returns
IndexOf(T)
Time complexity: O(log(n))
Declaration
public int IndexOf(T item)
Parameters
| Type |
Name |
Description |
| T |
item |
|
Returns
Insert(T)
Time complexity: O(log(n))
Declaration
public void Insert(T value)
Parameters
| Type |
Name |
Description |
| T |
value |
|
NextHigher(T)
Get the next higher value to given value in this BST.
Time complexity: O(n).
Declaration
public T NextHigher(T value)
Parameters
| Type |
Name |
Description |
| T |
value |
|
Returns
NextLower(T)
Get the next lower value to given value in this BST.
Time complexity: O(n).
Declaration
public T NextLower(T value)
Parameters
| Type |
Name |
Description |
| T |
value |
|
Returns
RemoveAt(Int32)
Time complexity: O(log(n))
Declaration
public T RemoveAt(int index)
Parameters
| Type |
Name |
Description |
| Int32 |
index |
|
Returns
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Implements