The Coding Monkey Collections
This library contains collections and algorithms that are not part of the standard .NET Generic Collections. This library is compatible with the full .NET library, as well as .NET Core.
Collections
Binary Search Tree Implementations
There are three Generic Binary Search Tree implementations in the library. All three require that the Key implement IComparable
Basic Unbalanced Binary Search Tree
The BinarySearchTree class is the base class for the other more specialized versions. The basic tree will degrade in performce over time, as items are added depending on the order in which they are added. Adding the same keys to the tree in different orders can affect performance because the tree does not self balance. Average times for all operations are therefore O(log n) with a worst case of O(n).
Red Black Tree
A Red Black Tree is a type of self balancing binary search tree. Each node tracks a color enumeration, and therefore stores slightly more information about the node than a standard binary search tree. Because it is self balancing, all operations are O(log n).
AVL Tree
The AVL Tree is an implementation of a balanced binary search tree named after Adelson-Velsky and Landis. An AVL Tree will be slightly faster than a Red Black Tree because the balancing is more strict. All operations are O(log n).
Iterators
Binary Search Trees support iteration in differnet ways. All of the Binary Search Tree implementations support the following iterators:
Skip List
Skip lists are a data structure that defines a linked hierary of sublists, with each sublist having fewer items than the one before. In many ways its a combination of an array with a linked list. Search and insert are both O(log n).
This implementation implements IDictionary<TKey, TValue>
and can be used as a drop in replacement for the Dictionary
class, assuming that TKey
implements ICompareable<T>
.
Linked List
This linked list implementation was origionally written prior to .NET 2.0, which is when Microsoft added its own LinkedList implementation to the System.Collections.Generic
namespace. It supports many of the same operations, though with slightly different method names.
Command Line Argument Collection
The command line argument collection takes the argument string from a main
function, and parses command line switches, adding them to an internal dictionary.
Valid parameters forms are:
{-,/,--}param{ ,=,:}((",')value(",'))
Examples: -param1 value1 --param2 /param3:"Test-:-work" /param4=happy -param5 '--=nice=--'
Sorting Algorithms
Implemented several popular sorting algorithms that all operate generically on any collection wich implements IList<T>
where T
implements IComparable
. A summary of the different performance characteristics of these algorithms is also available.
In Place Sorting Algorithms
These algorithms modify the list which is passed into the sorting function. They all derive from IInPlaceSort<T>
- Quick Sort
- Bubble Sort
- Heap Sort
- Odd Even Sort
- Comb Sort
- Shell Sort
- Bitonic Merge Sort
- Insertion Sort
- Selection Sort
Out of Place Sorting Algorithms
These algorithms create a new list sorted list from the unsorted list passed into the sorting function. They all derive from IOutOfPlaceSort<T>
Library References
Full reference documentation of the class library is available as well.