Question: Fill in code on right in c++ and follow all constraints and directions. 1node compress(node* head) 21/ fill in code here This problem has you

 Fill in code on right in c++ and follow all constraints

Fill in code on right in c++ and follow all constraints and directions.

1node compress(node* head) 21/ fill in code here This problem has you modify a linked lists composed of node objects chained together via node pointers. Each node has a next pointer which points to the next node in the chain. The last node s identified by having a NULL next pointer The linked lists for this lab store string data. Some of the strings in the linked lists repeat, and we'd like to eliminate this repetition. Specifically, if a string repeats, we want to eliminate the duplicates so that the resulting linked list only has one copy of a string in a row. (The string can repeat later in the linked list, as long as some other string occurs in between.) 4 Create a function compress, which takes in a pointer to the head of the linked list, and returns a pointer to the head of a linked list in which repetition has been eliminated. The linked list for this problem uses the following class declaration: class node public: string data node next; 3: Notes and Constraints The linked list starting at head contains between 1 and 25 nodes, inclusive. Examples 1. "apple"NULL return "apple"->NULL 2. "apple"->"apple"->NULL return "apple" ->NULL 3. "green"- >"green">blue->"red"->"green"-NULL return "green" >"blue" >"red" >"green NULL

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!