Пример #1
0
 public void InsertHead(T data)
 {
     if (HEAD.Next != null)
     {
         SNode <T> newNode = new SNode <T>(data, HEAD.Next);
         HEAD.Next = newNode;
     }
     else
     {
         HEAD.Next = new SNode <T>(data);
     }
 }
Пример #2
0
        public void Append(T data)
        {
            SNode <T> newNode = new SNode <T>(data);

            if (ListIsEmpty())
            {
                HEAD.Next = newNode;
            }
            else
            {
                SNode <T> temp = HEAD.Next;
                while (temp.Next != null)
                {
                    temp = temp.Next;
                }
                temp.Next = newNode;
            }
        }
Пример #3
0
 public SNode(T data, SNode <T> next)
 {
     Next = next;
     Data = data;
 }
Пример #4
0
 public SNode()
 {
     Data = default(T);
     Next = null;
 }
Пример #5
0
 public SinglyLinkedList()
 {
     HEAD = new SNode <T>();
 }