Click here to Skip to main content
15,886,199 members
Articles / Programming Languages / C#

Back to Basics - Generic Data Structures and Algorithms In .NET 2.0

Rate me:
Please Sign up or sign in to vote.
4.96/5 (93 votes)
23 Apr 2007Ms-PL15 min read 278.8K   2.6K   300  
Implementations of generic data structures and algorithms in .NET 2.0.
using System;
using System.Collections.Generic;
using System.Text;

namespace DataStructuresDotNet.DataStructures
{
	internal class SkipListNode<TKey, TValue>
	{
		#region Globals

		private TKey thisKey;
		private TValue thisValue;
		private SkipListNode<TKey, TValue> rightNode, upNode, downNode;

		#endregion

		#region Construction

		/// <summary>
		/// Initializes a new instance of the <see cref="SkipListNode&lt;TKey, TValue&gt;"/> class.
		/// </summary>
		internal SkipListNode()	{}

		/// <summary>
		/// Initializes a new instance of the <see cref="SkipListNode&lt;TKey, TValue&gt;"/> class.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <param name="val">The value.</param>
		internal SkipListNode(TKey key, TValue val)
		{
			thisKey = key;
			thisValue = val;
		}

		#endregion

		#region Properties

		/// <summary>
		/// Gets or sets the key.
		/// </summary>
		/// <value>The key.</value>
		internal TKey Key
		{
			get
			{
				return thisKey;
			}
			set
			{
				thisKey = value;
			}
		}

		/// <summary>
		/// Gets or sets the value.
		/// </summary>
		/// <value>The value.</value>
		internal TValue Value
		{
			get
			{
				return thisValue;
			}
			set
			{
				thisValue = value;
			}
		}

		/// <summary>
		/// Gets or sets the right node.
		/// </summary>
		/// <value>The right node.</value>
		internal SkipListNode<TKey, TValue> Right
		{
			get
			{
				return rightNode;
			}
			set
			{
				rightNode = value;
			}
		}

		/// <summary>
		/// Gets or sets the up node.
		/// </summary>
		/// <value>The up node.</value>
		internal SkipListNode<TKey, TValue> Up
		{
			get
			{
				return upNode;
			}
			set
			{
				upNode = value;
			}
		}

		/// <summary>
		/// Gets or sets the down node.
		/// </summary>
		/// <value>The down node.</value>
		internal SkipListNode<TKey, TValue> Down
		{
			get
			{
				return downNode;
			}
			set
			{
				downNode = value;
			}
		}

		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Web Developer
South Africa South Africa
The author is a software consultant in South Africa, specializing in bespoke software solutions.

Comments and Discussions