Class TernarySearchTree<T>
A ternary search tree implementation.
Inheritance
TernarySearchTree<T>
Assembly: Advanced.Algorithms.dll
Syntax
public class TernarySearchTree<T> : IEnumerable<T[]>, IEnumerable where T : IComparable
Type Parameters
Constructors
|
Improve this Doc
View Source
TernarySearchTree()
Declaration
public TernarySearchTree()
Properties
|
Improve this Doc
View Source
Count
Declaration
public int Count { get; }
Property Value
Methods
|
Improve this Doc
View Source
Contains(T[])
Returns true if the entry exist.
Time complexity: O(e) where e is the length of the given entry.
Declaration
public bool Contains(T[] entry)
Parameters
Type |
Name |
Description |
T[] |
entry |
|
Returns
|
Improve this Doc
View Source
ContainsPrefix(T[])
Returns true if the entry prefix exist.
Time complexity: O(e) where e is the length of the given entry.
Declaration
public bool ContainsPrefix(T[] entry)
Parameters
Type |
Name |
Description |
T[] |
entry |
|
Returns
|
Improve this Doc
View Source
Delete(T[])
Deletes a record from this ternary search tree.
Time complexity: O(m) where m is the length of entry.
Declaration
public void Delete(T[] entry)
Parameters
Type |
Name |
Description |
T[] |
entry |
|
|
Improve this Doc
View Source
GetEnumerator()
Declaration
public IEnumerator<T[]> GetEnumerator()
Returns
|
Improve this Doc
View Source
Insert(T[])
Time complexity: O(m) where m is the length of entry.
Declaration
public void Insert(T[] entry)
Parameters
Type |
Name |
Description |
T[] |
entry |
|
|
Improve this Doc
View Source
StartsWith(T[])
Returns a list of records matching this prefix.
Time complexity: O(rm) where r is the number of results and m is the average length of each entry.
Declaration
public List<T[]> StartsWith(T[] prefix)
Parameters
Type |
Name |
Description |
T[] |
prefix |
|
Returns
Type |
Description |
List<T[]> |
|
Explicit Interface Implementations
|
Improve this Doc
View Source
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Implements