Class SkipList<T>
A skip list implementation with IEnumerable support.
Inherited Members
Namespace: Advanced.Algorithms.DataStructures
Assembly: Advanced.Algorithms.dll
Syntax
public class SkipList<T> : IEnumerable<T>, IEnumerable where T : IComparable
Type Parameters
Name | Description |
---|---|
T | The data type of thi skip list. |
Constructors
| Improve this Doc View SourceSkipList(Int32)
Declaration
public SkipList(int maxHeight = 32)
Parameters
Type | Name | Description |
---|---|---|
Int32 | maxHeight | The maximum height. |
Fields
| Improve this Doc View SourceMaxHeight
The maximum height of this skip list with which it was initialized.
Declaration
public readonly int MaxHeight
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceCount
The number of elements in this skip list.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceDelete(T)
Deletes the given value from this skip list. Will throw exception if the value does'nt exist in this skip list. Time complexity: O(log(n))
Declaration
public void Delete(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to delete. |
Find(T)
Finds the given value in this skip list. If item is not found default value of T will be returned. Time complexity: O(log(n)).
Declaration
public T Find(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value |
Returns
Type | Description |
---|---|
T |
GetEnumerator()
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<T> |
Insert(T)
Inserts the given value to this skip list. Will throw exception if the value already exists. Time complexity: O(log(n))
Declaration
public void Insert(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to insert. |
Explicit Interface Implementations
| Improve this Doc View SourceIEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |