Example #1
0
 public void Add(DoublyLinkedListNode <T> newNode)
 {
     if (head == null)
     {
         head = newNode;
     }
     else
     {
         var current = head;
         while (current != null && current.Next != null)
         {
             current = current.Next;
         }
         // 양방향 연결
         current.Next = newNode;
         newNode.Prev = current;
         newNode.Next = null;
     }
 }
Example #2
0
        public void AddHead(T value)
        {
            //AddHead(new DoublyLinkedListNode<T>(value));
            var oldHead = Head;
            var adding  = new DoublyLinkedListNode <T>(value);

            Head = adding;

            Head.Next = oldHead;
            if (Count == 0)
            {
                Tail = Head;
            }
            else
            {
                oldHead.Previous = Head;
            }
            Count++;
        }
Example #3
0
 public DoublyLinkedListNode(T data, DoublyLinkedListNode <T> prev, DoublyLinkedListNode <T> next)
 {
     this.Data = data;
     this.Prev = prev;
     this.Next = next;
 }
Example #4
0
 public DoublyLinkedListNode(T value, DoublyLinkedListNode <T> next, DoublyLinkedListNode <T> previous)
 {
     Value = value;
     //Next = next;
 }