Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions

Question

help asp

Answered: 1 week ago

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago