Name: ________________________________ Section: _________________
Honor Code Acknowledgment: ___________________
Due: October 24
struct Node { string info; Node * next; Node(string in_info, Node * follow = 0) { info = in_info; next = follow; } };Complete the function Duplicate below which replaces each node in a linked list of names with two nodes with that name. For example if first pointed to the linked list:
first | v "mo" -> "po" -> "so" -> 0Then after Duplicate(first), the list would look like:
first | v "mo" -> "mo" -> "po" -> "po" -> "so" -> "so" -> 0
void Duplicate(Node * & list) // postcondition: list contains the names a1, a2, ... an // postcondition: list contains the names a1, a1, a2, a2, ..., an, an