示例#1
0
        public DoublyLinkedListNode InsertAtFront(DoublyLinkedListNode doublyLinkedListNode,
                                                  int data)
        {
            if (size == capacity)
            {
                Console.WriteLine("Doubly Linked List is full! Cannot insert!");
                return(doublyLinkedListNode);
            }

            size++;
            if (doublyLinkedListNode == null)
            {
                doublyLinkedListNode = new DoublyLinkedListNode(data);
                return(doublyLinkedListNode);
            }

            DoublyLinkedListNode doublyLinkedListNodeNew = new DoublyLinkedListNode(data);

            doublyLinkedListNodeNew.SetDoublyLinkedListNodeNext(doublyLinkedListNode);
            doublyLinkedListNode.SetDoublyLinkedListNodePrevious(doublyLinkedListNodeNew);
            doublyLinkedListNode = doublyLinkedListNodeNew;
            return(doublyLinkedListNode);
        }
示例#2
0
 public void SetDoublyLinkedListNodeHead(DoublyLinkedListNode doublyLinkedListNode)
 {
     head = doublyLinkedListNode;
 }
示例#3
0
 public void SetDoublyLinkedListNodeNext(DoublyLinkedListNode doublyLinkedListNode)
 {
     nextNode = doublyLinkedListNode;
 }
示例#4
0
 public DoublyLinkedList(DoublyLinkedListNode doublyLinkedListNode, int capacity)
 {
     this.capacity = capacity;
     head          = doublyLinkedListNode;
 }
示例#5
0
 public void SetDoublyLinkedListNodePrevious(DoublyLinkedListNode doublyLinkedListNode)
 {
     previousNode = doublyLinkedListNode;
 }