The goal for this exercise is practice traversing the linked list, and stopping at a particular node, in preparation for the ‘Insert a value at an arbitrary location’ exercise in the future.
For this exercise, you need to implement the PrintNode 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.
The PrintNode method looks like:
public
void PrintNode(uint i);
Instead of printing all the elements in the list, it only prints the data of the node at index i. Remember that uints (“unsigned ints”) can only have positive values, so you don’t have to worry about someone trying to print node -1. However, the caller can pass in any value that (s)he wants, so you'll have to watch out for someone asking to print the node at index 10 (or 6) in a 5 node list. If that happens, your method should not print anything to the screen.
If the list is empty then this method should print out nothing (not even an empty Console.WriteLine(); )
What you need to do for this exercise
Implement PrintNode, as described above
Implement anything required by PrintNode
NUnit_Tests_LL_PrintNode
class. They should all pass at this point, and
if not, then you should fix your program so that those tests do pass.
You can run the tests using the NUnit support in the provided starter
project. You should feel free to supplement that code with your own
test cases if you wish, but you are neither required nor expected to.