Traversing The List

The goal for this exercise is to add a Print method to your simple Linked List class, in order to gain experience with algorithms that traverse a linked list.

For this exercise, you need to implement the PrintAll method in the provided MyIntList class, as well as any other methods that you need to implement in order to accomplish the goal of implementing this method.  This class should be found in the Student_Answers.cs file, in a project named something like 03_PCE_StudentCode.  

            The ‘PrintAll’ method should iterate through all the nodes, one at a time, and call the Print method on each one.  (Obviously, if your LinkedListNode class doesn't yet have a Print method, you'll have to add one).   The print method for each node should print out a single line, that contains only the number (the Data) that the node is storing.  Because PrintAll should call this method on each object in sequence, the correct output calling PrintAll on a list that contains {1, 2, 3} should be:

1
2
3

Hint: Start at one end of the list, and continue to loop while your reference isn't null, printing as you go.

What you need to do for this exercise

  1.  Implement PrintAll, as described above

    1. Implement anything required by PrintAll