public void AddATail(int val) { if (this.Head == null) { AddATHead(val); } else { DoubleLinkedListNode tempNode = new DoubleLinkedListNode(val); DoubleLinkedListNode TailNode = GetTail(); tempNode.Prev = TailNode; TailNode.Next = tempNode; } }
public MyDoubleLinkedList() { Head = null; }
public int GetIndexValue(int index) { DoubleLinkedListNode curr = GetIndexNode(index); return(curr == null ? -1 : curr.Val); }
public DoubleLinkedListNode(int val) { this.Val = val; this.Prev = this.Next = null; }