Example #1
0
        //Adds a new node at the top of the stack
        public void addFirst(string newString)
        {
            StringNode newNode = new StringNode(newString);

            newNode.Next = head;
            head         = newNode;
        }
        public string deleteFirst()
        {
            string data = null;
            StringNode toDelete = new StringNode(data);

            toDelete = head;
            head = head.Next;
            return toDelete.Data;
        }
Example #3
0
        public string deleteFirst()
        {
            string     data     = null;
            StringNode toDelete = new StringNode(data);

            toDelete = head;
            head     = head.Next;
            return(toDelete.Data);
        }
Example #4
0
        public int Count()
        {
            int        count      = 0;
            StringNode nodeWalker = head;

            while (nodeWalker != null)
            {
                count++;
                nodeWalker = nodeWalker.Next;
            }
            return(count);
        }
 //Adds a new node at the top of the stack
 public void addFirst(string newString)
 {
     StringNode newNode = new StringNode(newString);
     newNode.Next = head;
     head = newNode;
 }
 public StringNodeList()
 {
     head = null;
 }
Example #7
0
 public StringNode(string data)
 {
     Data = data;
     Next = null;
 }
Example #8
0
 public StringNodeList()
 {
     head = null;
 }