Table of Contents

Class OrderedSymbolTableWithOrderedKeyArray<TKey, TValue>

Namespace
AlgorithmsSW.SymbolTable
Assembly
AlgorithmsSW.dll
[ExerciseReference(3, 1, 12)]
public class OrderedSymbolTableWithOrderedKeyArray<TKey, TValue> : IOrderedSymbolTable<TKey, TValue>, ISymbolTable<TKey, TValue>, IReadOnlySymbolTable<TKey, TValue>

Type Parameters

TKey
TValue
Inheritance
OrderedSymbolTableWithOrderedKeyArray<TKey, TValue>
Implements
IOrderedSymbolTable<TKey, TValue>
ISymbolTable<TKey, TValue>
IReadOnlySymbolTable<TKey, TValue>
Inherited Members
Extension Methods

Constructors

OrderedSymbolTableWithOrderedKeyArray(IComparer<TKey>)

public OrderedSymbolTableWithOrderedKeyArray(IComparer<TKey> comparer)

Parameters

comparer IComparer<TKey>

OrderedSymbolTableWithOrderedKeyArray(int, IComparer<TKey>)

public OrderedSymbolTableWithOrderedKeyArray(int initialCapacity, IComparer<TKey> comparer)

Parameters

initialCapacity int
comparer IComparer<TKey>

Properties

Comparer

public IComparer<TKey> Comparer { get; }

Property Value

IComparer<TKey>

Count

Gets the number of key/value pairs contained in the symbol table.

public int Count { get; }

Property Value

int

Keys

Gets an IEnumerable<T> containing the keys of the symbol table.

public IEnumerable<TKey> Keys { get; }

Property Value

IEnumerable<TKey>

Methods

Add(TKey, TValue)

Adds the specified key and value to the symbol table.

public void Add(TKey key, TValue value)

Parameters

key TKey

The key of the element to add.

value TValue

The value of the element to add.

ContainsKey(TKey)

Determines whether the symbol table contains a specific key.

public bool ContainsKey(TKey key)

Parameters

key TKey

The key to locate in the symbol table.

Returns

bool

true if the symbol table contains an element with the specified key; otherwise, false.

CountRange(TKey, TKey)

public int CountRange(TKey start, TKey end)

Parameters

start TKey
end TKey

Returns

int

KeyWithRank(int)

public TKey KeyWithRank(int rank)

Parameters

rank int

Returns

TKey

KeysRange(TKey, TKey)

public IEnumerable<TKey> KeysRange(TKey start, TKey end)

Parameters

start TKey
end TKey

Returns

IEnumerable<TKey>

LargestKeyLessThanOrEqualTo(TKey)

public TKey LargestKeyLessThanOrEqualTo(TKey key)

Parameters

key TKey

Returns

TKey

MaxKey()

public TKey MaxKey()

Returns

TKey

MinKey()

public TKey MinKey()

Returns

TKey

RankOf(TKey)

public int RankOf(TKey key)

Parameters

key TKey

Returns

int

RemoveKey(TKey)

Removes the element with the specified key from the symbol table.

public void RemoveKey(TKey key)

Parameters

key TKey

The key of the element to remove.

SmallestKeyGreaterThanOrEqualTo(TKey)

public TKey SmallestKeyGreaterThanOrEqualTo(TKey key)

Parameters

key TKey

Returns

TKey

TryGetValue(TKey, out TValue)

Tries to get the value associated with the specified key from the symbol table.

public bool TryGetValue(TKey key, out TValue value)

Parameters

key TKey

The key of the value to get.

value TValue

When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns

bool

true if the symbol table contains an element with the specified key; otherwise, false.