示例#1
0
        public void AddFirst(E element)
        {
            SNode <E> newest = new SNode <E>(element, head);

            head = newest;
            if (IsEmpty())
            {
                tail = newest;
            }
            size++;
        }
示例#2
0
        public E RemoveFirst()
        {
            SNode <E> temp = head;

            head      = temp.Next;
            temp.Next = null;
            E tempElement = temp.Element;

            temp.Element = default;
            size--;
            return(tempElement);
        }
示例#3
0
        public void AddLast(E element)
        {
            SNode <E> newest = new SNode <E>(element, null);


            if (IsEmpty())
            {
                head = newest;
            }
            else
            {
                tail.Next = newest;
            }
            tail = newest;
            size++;
        }
示例#4
0
 public SNode(E element, SNode <E> next)
 {
     Element = element;
     Next    = next;
 }
示例#5
0
 public SList()
 {
     head = null;
     tail = null;
 }