public void TestLinkedListUpperBoundary() { var linkedList = new LinkedList.LinkedList(); linkedList.AddLast(20); linkedList.AddLast(21); linkedList.AddLast(22); var actual = linkedList.ElementFromTailAt(3).Value; }
public void GetFirstElementFromTail() { var linkedList = new LinkedList.LinkedList(); linkedList.AddLast(20); linkedList.AddLast(21); linkedList.AddLast(22); var actual = linkedList.ElementFromTailAt(0).Value; var expected = 22; Assert.AreEqual(expected, actual); }
public void Enqueue(int val) { if (_linkedList.Count == 0) { _linkedList.AddLast(val); } else { LinkedListNode current = _linkedList.Head; while (current != null && current.Value.CompareTo(val) < 0) { current = current.Next; } if (current == null) { _linkedList.AddLast(val); } else { _linkedList.AddBefore(val, current.Value); } } }
public void Enqueue(int val) { _linkedList.AddLast(val); }