NGenerics overview - the Priority Queue

Previous instalments General Data Structures HashList ObjectMatrix Trees GeneralTree and the Visitor Pattern Binary Trees and Binary Search Trees The Priority Queue data structure has the same basic behaviour and operations as the classic queue found in .NET. A queue applies a first-in, first-out (FIFO) approach to a list of objects. This data structure is typically used in message processing to process messages in order of arrival. Queue implementations tend to have the following operations available : [Read More]

NGenerics Overview - The ObjectMatrix

Previous instalments General Data Structures HashList Trees GeneralTree and the Visitor Pattern Binary Trees and Binary Search Trees Looking at tree structures will make your eyes bleed, so we’ll take a break to discuss one of the simpler data structures NGenerics offers - the ObjectMatrix. The ObjectMatrix is a representation of a 2-dimensional array of objects, like, for example, a game board : Why not use a two-dimensional array in the first place? [Read More]

NGenerics Overview - Binary Trees and Binary Search Trees

Previous instalments General Data Structures HashList Trees GeneralTree and the Visitor Pattern If you haven’t read my previous post on General Trees, it might be a good idea to do so before reading further. A Binary Tree is a refined version of the General Tree that limits the number of children each node can have - two to be exact. Child nodes are thus referred to as the Left and Right child nodes. [Read More]

NGenerics overview - GeneralTree and the Visitor pattern

Previous instalments General Data Structures HashList [ Note : This post feels a little like Computer Science 101 - but I felt it necessary to discuss the basic tree concepts before we move on to some of the more specialized trees like search trees. ] The GeneralTree<T> class in NGenerics provides a way of defining tree structures in a simple, recursive way. It has a simple, recursive definition : public class GeneralTree { T nodeData; List childNodes; } Visually, we can represent it, well, as a tree : In contrast to some of the more specialized tree structures (like binary trees and search trees), the GeneralTree enforces no constraints on the structure of the tree. [Read More]

NGenerics overview - the HashList

Something that I find a use for in almost every project I work on, is the HashList (also known as a MultiMap in the Java world) in NGenerics 1.2. A HashList is a multi-valued dictionary that uses a Dictionary<TKey, IList> under the covers. It still retains dictionary semantics but handles the creation and destruction of the key/list pairs itself. For example, adding a couple of items to the HashList will have the following result: [Read More]