当前位置:编程学习 > C#/ASP.NET >>

C#单链表的实现及其应用

单链表结点类的实现如下所示。
       public class Node<T>
        {
            private T data; //数据域
            private Node<T> next; //引用域
            //构造器
            public Node(T val, Node<T> p)
            {
                data = val;
                next = p;
            }
            //构造器
            public Node(Node<T> p)
            {
                next = p;
            }
            //构造器
            public Node(T val)
            {
                data = val;
                next = null;
            }
            //构造器
            public Node()
            {
                data = default(T);
                next = null;
            }
            //数据域属性
            public T Data
            {
                get
                {
                    return data;
                }
                set
                {
                    data = value;
                }
            }
            //引用域属性
            public Node<T> Next
            {
              &n

补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,