Exam 2 Santa Factor

The area most of you had problems with was in the linked list section of the exam. I want you to work on this area for some extra credit (if you need help).

You are free to discuss this problem with your team, but anyone wishing extra credit must write their own code.

Here is the problem

  1. Create a class that will build a linked list of integers.
  2. Use that class to set up a linked list called L1.
  3. Fill the list with 100 integers, so that each node in your list has sequentials numbers between 1 and 100 (the list is now numbered.)
  4. Use a copy constructor to create two additional lists named L2, and L2. (Hmmm, wonder where this problem is coming from!)
  5. For each list, use the Random class we showed in class to pick 20 random numbers between 1 and 100. Delete the node holding that number from the list. THis will delete random nodes from each list, not the same node in each list).
  6. Print out your lists, with one node from each list in a single line. (If yo exhaust your list, you need to output suffient blank spaces to fil up the column used for thise numbers. Look up iomanip for some help with this.
  7. Here is the final goal. For every node in each list, find the “closest” nummbers in each of the other two lists. You need to find a node “ahead” of this node in any lane, nodes close “behind” and nodes “even; with the given node. Print out the three numbers for each list using a pattern like |xx|yy|zz|

iAs an example of what you are to produce, here is the output from my code demonstrating all of this: