Пример #1
0
 public void Pop()
 {
     if (head == null)
     {
         Console.WriteLine("stack is empty");
     }
     else
     {
         head = head.next;
     }
     size--;
 }
Пример #2
0
        private void Add(NodeStack <T> node)
        {
            NodeStack <T> current = node;

            if (head == null)
            {
                current.next = null;
            }
            else
            {
                current.next = head;
            }
            head = node;
            size++;
        }
Пример #3
0
 public NodeStack(T newData)
 {
     data = newData;
     next = null;
 }
Пример #4
0
        public void Push(T data)
        {
            NodeStack <T> node = new NodeStack <T>(data);

            Add(node);
        }
Пример #5
0
 public StackList()
 {
     head = null;
     size = 0;
 }