Name (print): ________________________________
Honor Code Acknowledgment: _____________________________
Due: October 1
Write a nonrecursive function called RemoveEveryThird which removes every third node of a linked list.
Let each item in the list be represented by the struct Node:
struct Node
{
string name;
Node * next;
};
For example, consider the following list:
RemoveEveryThird(names) returns 2 and the list names is modified to look like:
Calling RemoveEveryThird(names) again returns 2 and the list names is modified to look like:
Complete the function RemoveEveryThird below.
int RemoveEveryThird(Node * list)
// postcondition: Removes every third node from list and returns the
// number of nodes removed. If the list has two or fewer
// nodes, no nodes are removed and 0 is returned.
{