public DoubleNode GetLastNode(DoubleNode doublyList) { DoubleNode temp = headNode; while (temp.next != null) { temp = temp.next; } return(temp); }
public void AddToEnd(string data) { var newNode = new DoubleNode(data); if (headNode == null) { headNode = newNode; return; } var lastNode = GetLastNode(this.headNode); lastNode.next = newNode; newNode.previous = lastNode; }
public void AddToBeginning(string data) { var newNode = new DoubleNode(data); newNode.next = headNode; newNode.previous = null; if (headNode != null) { headNode.previous = headNode; } headNode = newNode; }
public DoublyLinkedList() { headNode = null; }
public DoubleNode(string a) { data = a; next = null; previous = null; }