C# 链表结构(1)-结点
2012-02-09 17:55
337 查看
以一个类来定义结点类,其中包含结点数据值,前结点,后结点(双向链表的情况有前、后结点)。
参考自:http://www.cnblogs.com/linzheng/news/2011/07/14/2106530.html
using System; using System.Collections.Generic; using System.Text; namespace Csharp { public class Node<T> where T : IComparable<T> { T data; /// <summary> /// the current data /// </summary> public T Data { get { return this.data; } set { this.data = value; } } Node<T> next; /// <summary> /// the next node /// </summary> public Node<T> Next { get { return this.next; } set { this.next = value; } } Node<T> prev; /// <summary> /// the prev node /// </summary> public Node<T> Prev { get { return this.prev; } set { this.prev = value; } } /// <summary> /// no arguments to constitution /// </summary> public Node() { this.data = default(T); this.next = null; this.prev = null; } /// <summary> /// one data to constitution /// </summary> /// <param name="t">a data</param> public Node(T t) { this.data = t; this.next = null; this.prev = null; } /// <summary> /// three data to constitution /// </summary> /// <param name="t">the current data</param> /// <param name="next_">the next data</param> /// <param name="prev_">the previous data</param> public Node(T t, Node<T> next_, Node<T> prev_) { this.data = t; this.next = next_; this.prev = prev_; } } }
参考自:http://www.cnblogs.com/linzheng/news/2011/07/14/2106530.html
相关文章推荐
- 【数据结构】单链表—寻找两个相交链表中第一个公共结点 — 蛮力法 / 栈 / 指针先走
- 结构之美:查找单链表指定位置结点的数据
- 【数据结构基础】链表的倒数第M个结点的查找
- 数据结构课程设计-----用C#实现双向链表
- 数据结构(C#)--双向链表
- c#数据结构———链表2
- 数据结构——算法之(027)( 在O(1)时间内删除链表结点)
- bo2-2.cpp 带有头结点的单链表(存储结构由c2-2.h定义)的基本操作(12个)
- 数据结构(5)线性表之链表C++实现带头结点的单链表合并
- 数据结构基础 - 链表的创建(C和C#代码)
- 数据结构——算法之(004)(输入一个单向链表,输出该链表中倒数第k个结点)
- 【数据结构】单链表—链表中倒数第K个结点 — 快慢指针
- 数据结构:不带头结点的单链表
- 笔试题3:链表的结点结构操作
- 结构之美:单链表的头结点与头指针
- C++ 单链表基本操作分析与实现 链表 链表是一种物理存储单元上非连续、非顺序的存储结构,数据元素的逻辑顺序是通过链表中的指针链接次序实现的。链表由一系列结点(链表中每一个元素称为结点)组成,结
- C#使用链表结构(intptr)与c语言 dll配合使用。
- 数据结构(二):Java实现:链表实现增删查操作(具有头结点)
- 数据结构(C#):循环链表
- (学习java)带有头结点的单链表结构