Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the the sample code of linked list node1.h and node1.cpp Implement the list_piece() function and a driver main program. Implement a main program that

Using the the sample code of linked list node1.h and node1.cpp

Implement the list_piece() function and a driver main program.

Implement a main program that takes a text file as an input (as a command line argument or after a prompt) and processes followings. The words in the input text file should be stored in a linked list, one word at a node. So you have to modify the node1.h to accommodate a string. Then ask the user to pick two words, one for the starting and one for the ending word. And search the original list to find a new sub-list that contains the items, as a starting and ending node, and print out the new list. When you print, include the last word. So you have to implement the list_piece() to include the last word as well. If there's no such sub-list, just print out an error message.

Once you printout the new sub-list, you need to sort the sub-list (in dictionary order) using the insertion sort algorithm and print out the new sorted sub-list. When you sort the list, you must rearrange the link structure of nodes by updating associated pointers, not by copying/moving the strings between nodes.

Just in case, here's a detailed description of the insertion sort algorithm and a sample implementation.

The input text file may have sentences with punctuation marks. But to simplify the issue, let's assume that the text file will have only five punctuation marks . , ' - ? . So when you assign a string to a node, you need to get rid of those five punctuation marks and store only the word itself.

Note that the main objective of this homework is to reinforce the

*****see comment for node h and cpp file

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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions