Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

What are values?

Answered: 1 week ago