14.二叉链表结点类

namespace DSList
{
    public class TreeNode<T>
    {
        private T data;
        private TreeNode<T> lChild;
        private TreeNode<T> rChild;
        public T Data
        {
            get
            {
                return data;
            }
            set
            {
                data = value;
            }
        }
        public TreeNode<T> LChild
        {
            get
            {
                return lChild;
            }
            set
            {
                lChild = value;
            }
        }
        public TreeNode<T> RChild
        {
            get
            {
                return rChild;
            }
            set
            {
                rChild = value;
            }
        }
        public TreeNode(T val, TreeNode<T> lc, TreeNode<T> rc)
        {
            data = val;
            lChild = lc;
            rChild = rc;
        }
        public TreeNode(TreeNode<T> lc, TreeNode<T> rc)
        {
            data = default(T);
            lChild = lc;
            rChild = rc;
        }
        public TreeNode(T val)
        {
            data = val;
            lChild = null;
            rChild = null;
        }
        public TreeNode()
        {
            data = default(T);
            lChild = null;
            rChild = null;
        }
    }
}
posted @ 2011-03-27 01:09  山之松  阅读(110)  评论(0编辑  收藏  举报