Skip to content
Priority queue, reversible dictionary, reversible sorted dictionary, dynamic multidimensional array, heap, heapsort etc.
C#
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Common
Sinbadsoft.Lib.Collections.Tests
Sinbadsoft.Lib.Collections
packages
publish
.gitignore
README.md
Sinbadsoft.Lib.Collections.sln

README.md

Priority Queue

Priority queue based on a max [heap](http://en.wikipedia.org/wiki/Heap_(data_structure). 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.

Reversible dictionary

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:

Dynamic Array

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.

License

Copyright 2009-2013 Sinbadsoft.

Licensed under the GNU Library General Public License (LGPL) version 2.1.

Something went wrong with that request. Please try again.