- 2
- 0
- 约9.55千字
- 约 9页
- 2023-08-12 发布于四川
- 举报
这是我之前学C#时候,老师布置的作业题目。用C#实现一个双链表。
我模仿linklist 的函数写了一个。鄙人不才,用的是纯粹的链表来实现。没有模仿微软那样用动态数组来实现链表。觉得那应该会是个不错的优化。
当然支持插删改查操作。同事,也提供索引指示器,支持foreach功能 并重载了加法运算符。
附上我的代码。里边还有个testcase类,是我为我的链表写的测试用例。你在program中调用就可以知道我写的代码的多措的。
以下是我的链表类的代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DoubleLinkHeadEnd
{
//带end节点,带length信息。
//插入时,可以插入空链表,或者,可以用新节点插入到链表end节点。
public class DoubleLinkT
{
public class Node
{
private Node _next;
public Node Next
{
get { return _next; }
原创力文档

文档评论(0)