C # implementation Linked list

Source: Internet
Author: User

List: A list is a set of arbitrary storage units to store data elements in a linear table. To do this, when storing data elements, in addition to storing information about the data element itself, store the address information of the data element that is adjacent to it. These two pieces of information form the storage image of the data element, known as the node. A domain called a node that stores information about the element itself, the domain that stores the address information stored with its adjacent data element is called the reference domain of the node.

Node class:

using System;


using System.Collections.Generic;


using System.Text;


namespace DateStructrues.Lists.Node


{


///<summary>


///node class.


///</summary>


///<typeparam name= "T" ></typeparam>


public class dnode<t>


  {


#region Fields


    //


//Data domain


    //


T _data;


    //


//Address field (next)


    //


dnode<t> _next;


    //


//Address field (prev)


    //


dnode<t> _prev;


#endregion


#region Constructor


///<summary>


///Builder


///</summary>


///<param name= "value" ></param>


public Dnode (T value)


    {


_data = value;


    }


///<summary>


///Builder


///</summary>


///<param name= "value" ></param>


///<param name= "prev" ></param>


///<param name= "Next" ></param>


public Dnode (T value, dnode<t> prev, dnode<t> next)


    {


_data = value;


_prev = prev;


_next = next;


    }


///<summary>


///Builder


///</summary>


Public Dnode () {}


#endregion


#region Properties


///<summary>


///Address Field properties (previous).


///</summary>


Public dnode<t> Prev


    {


Get


      {


return _prev;


      }


Set


      {


_prev = value;


      }


    }


///<summary>


///Address Field properties (next).


///</summary>


Public dnode<t> Next


    {


Get


      {


return _next;


      }


Set


      {


_next = value;


      }


    }


///<summary>


///data Field properties.


///</summary>


Public T Data


    {


Get


      {


return _data;


      }


Set


      {


_data = value;


      }


    }


#endregion


  }


}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.