Question: C++ Program: find the middle node in the linked list. You need reading integers from a text file ; using insertion sort the task is

C++ Program: find the middle node in the linked list. You need reading integers from a text file ; using insertion sort the task is to construct an ordered linked list (in ascending order).

put the giving integers list below in a text file.

91 322 9 10 77 8 999 12 133 14 8 538 29 91 88 702 361 637 99

II. inFile (use argv[1]): A text file contains a list of integers

********************************

II. outFile1 (use argv[2]): a text file includes

i) The completed sorted linked list;

ii) The memory address and the data in the middle node

outFile2( use argv[3]): All debugging outputs.

********************************

III. Data structure: Must have all the object classes as given below.

********************************

- A linkedList class

- listNode class

- data (int)

- next (listNode *)

- printNode (node) // use the format:

(this node data, this nodes memo address, next nodes memo address, next nodes data)

see print list example below.

- listHead (listNode *) // Initially it points to a dummy node

- constructLL ()

- findMiddleNode ()

- listInsert ()

- findSpot () // Use the findSpot algorithm steps taught in class.

- printList (listHead, outFile)

// print the list to outFile, from listHead to the end of the list in the following format:

listHead (this node data, this nodes memo address, next nodes memo address, next nodes data) (this node data, this nodes memo address, next nodes memo address, next nodes data) . . . . . NULL

For example:

listHead ( -9999, 001010, 101100, 3) (3, 101100, 010111, 7) ( 7, 010111, 101010, 18)............ --> 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!