public void InsertCell(ObjectCell afterCell, ObjectCell newCell) { newCell.Next = afterCell.Next; afterCell.Next = newCell; newCell.Next.Previous = newCell; newCell.Previous = afterCell; }
public void IterateFromEnd() { ObjectCell end = End; while (end != null) { Console.WriteLine(end.Value); end = end.Previous; } }
public void IterateFromTop() { ObjectCell top = Top; while (top != null) { Console.WriteLine(top.Value); top = top.Next; } }
public DoublyLinkedList() { Top = new ObjectCell(null); End = new ObjectCell(null); End.Next = null; End.Previous = Top; Top.Next = End; Top.Previous = null; }
public void AddCellAtEnd(ObjectCell newCell) { InsertCell(End.Previous, newCell); }
public void AddCellAtStart(ObjectCell newCell) { InsertCell(Top, newCell); }