Output of the program with LinkedListNode operations on a LinkedList. | Lecture 12 - slide 19 : 36 Program 4 |
Initial LinkedList 5 3 2 7 -4 0 node1 = lst.First; lst.Remove(node1); lst.AddLast(node1); 3 2 7 -4 0 5 Third element in list: node1 = lst.First; node1.Next.Next.Value == 7 lst.AddAfter(node1, 17); 3 17 2 7 -4 0 5 lst.AddAfter(node1, new LinkedListNode<int>(18)); 3 18 17 2 7 -4 0 5 node = node1.Next.Next.Next; lst.AddBefore(node, 99); 3 18 17 99 2 7 -4 0 5 node = node.Previous; lst.Remove(node); 3 18 17 2 7 -4 0 5 |