Learn Computer Science programming - C# and C++ Algorithms

 
C# Double Linked List (Doubly-Linked List)
A doubly-linked list is a linked data structure that consists of a set of data records that contain references to the previous and to the next record.

The code below implements a doubly-linked list as well as offering the feature to convert it to a cyclic linked list which simply links the head and tail togethe
Picture
Code
doublelinkedlist.zip
File Size: 2953 kb
File Type: zip
Download File

using System;

namespace LinkedList
{
/// <summary>
/// Summary description for Node.
/// </summary>
public class Node
{
protected Node nPrevious;
protected Node nNext;
protected object Object;


#region Properties
public object Value
{
get
{
return Object;
}
set
{
Object = value;
}
}


public Node Previous
{
get
{
return nPrevious;
}
set
{
nPrevious = value;
}
}


public Node Next
{
get
{
return nNext;
}
set
{
nNext = value;
}
}
#endregion


public Node(Node PrevNode, Node NextNode, object obj)
{
nPrevious = PrevNode;
nNext  = NextNode;
Object  = obj;
}
}
}