예제 #1
0
        public void AddtoStart(int d)
        {
            DoublyNode new_node = new DoublyNode(d);

            if (start == null)
            {
                start = new_node;
                end   = start;
            }
            else
            {
                start.prev    = new_node;
                new_node.next = start;
                start         = new_node;
            }
            size++;
        }
예제 #2
0
        public void AddtoEnd(int d)
        {
            DoublyNode new_node = new DoublyNode(d);

            if (start == null)
            {
                start = new_node;
                end   = start;
            }
            else
            {
                new_node.prev = end;
                end.next      = new_node;
                end           = new_node;
            }
            size++;
        }