Question: There is a new class, called node, which has two members: One integer-type variable, called data, which is used to store the current number,. One

There is a new class, called node, which has two members: One integer-type variable, called data, which is used to store the current number,. One pointer, called next, which is used to point to the next node object. There is an extra node pointer, called head, which is pointed to the first node object. The next pointer of the last node is pointed to NULL, indicating the end of the list. The requirments 1) Ask the user to input one integer indicating the numbers of the elements of the linked list (It is assumed that the integers are all positive integers and the input of users are valid). Then ask the user to input the elements of linked lists. 2) Covert the user input elements into a linked list for the further operations. 3) Further ask the user to input two integers left and right, where left right. 4) Sort the nodes of the list from position left to position right and print the sorted list. Note: 1. Assume all the input numbers are positive and less than ten. 2. 1 left right the size of the linked list. 3. The position of the linked list starts from 1.

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 Programming Questions!