TrieDictionary

November 15, 2020 ยท View on GitHub

Implements: IDictionary<string, T> IReadOnlyDictionary<string, T>

Represents a dictionary in which the key/value coupling is implemented via a Trie.


Constructors

TrieDictionary() Initializes a new instance of TrieDictionary that is empty.

TrieDictionary(IEnumerable<KeyValuePair<string, T>> collection) Initializes a new instance of TrieDictionary that contains every key/value pair from the input collection.


Properties

int Count Gets the number of elements in the TrieDictionary.

ICollection<string> Keys Gets an ICollection containing the keys of the TrieDictionary.

ICollection<T> Values Gets an ICollection containing the values of the TrieDictionary.

T this[string key] Gets or sets the element with the specified key.


Methods

void Add(string key, T value) Adds a key/value pair to the TrieDictionary. Complexity: O(L)

void Add(KeyValuePair<string, T> item) Adds a key/value pair to the TrieDictionary. Complexity: O(L)

void AddAll(IEnumerable<KeyValuePair<string, T>> collection) Adds a collection of key/value pairs to the TrieDictionary. Complexity: O(N*L)

void Clear() Removes all elements from the TrieDictionary.

bool Contains(KeyValuePair<string, T> item) Determines whether the TrieDictionary contains a specific key/value pair. Complexity: O(L)

bool ContainsAll(IEnumerable<KeyValuePair<string, T>> collection) Determines whether the TrieDictionary contains a specific collection of key/value pairs. Complexity: O(N*L)

void CopyTo(KeyValuePair<string, T>[] array, int arrayIndex) Copies the key/value pairs of the TrieDictionary to an Array, starting at a particular Array index. Complexity: O(N*L)

bool Remove(KeyValuePair<string, T> item) Removes a specific key/value pair from the TrieDictionary. Complexity: O(L)

bool ContainsKey(string key) Determines whether the TrieDictionary contains a specific key. Complexity: O(L)

KeyValuePair<string, T>[] GetWithPrefix(string prefix) Gets the key/value pairs stored in the TrieDictionary that are associated to keys that begin with the chosen prefix. Complexity: O(N*L)

bool Remove(string key) Removes a specific key from the TrieDictionary. Complexity: O(L)

bool TryGetValue(string key, out T value) Gets the value associated with the specified key. Complexity: O(L)