Priority queue based on a max heap. A comparer can be injected to control the priority function.
var queue = new PriorityQueue<int>();
queue.Enqueue(2);
queue.Enqueue(100);
queue.Peek(); // returns 100 doesn't mutate the queue
queue.Dequeue(); // return 100 and removes it from queue
The underlying heap structure and a derived heapsort algorithm are also available in the library.
Provides IReversibleDictionary<TKey,TValue>
an interface for reversible dictionaries. A reversible dictionary maintains a bijective association between keys and values (aka reverse keys). Two implementations are provided in the library:
SortedReversibleDictionary<K,V>
based onSortedDictionary
.ReversibleDictionary<T,V>
based onDictionary
.
DynamicArray<T>
is a multidimensional generic array based list. Just like List
but with configurable rank (see array rank).
var array = new DynamicArray<int>(2);
for (int i = 0; i < 1000; i++)
for (int j = 0; j < 1000; i++)
array[i, j] = i + j;
You can set an element at any position, the array will grow automatically:
var array = new DynamicArray<string>(3);
array[100,999,29] = "hello";
The dynamic array can be resized up or down, globally or per dimension using Resize
and ResizeDim
A regular array can be extracted using the ToArray
method or by type conversion.
var darray = new DynamicArray<string>(2);
var array = (string[,])darray;
An array can be inserted into the dynamic array at any given position, puhsing elements along any given dimension using the Insert
method.
Copyright 2009-2013 Sinbadsoft.
Licensed under the GNU Library General Public License (LGPL) version 2.1.