Question: JAVA Program: reverse a linked list and find the middle node in the linked list. inFile (use argv[1]): A text file contains a list of
JAVA Program: reverse a linked list and find the middle node in the linked list.
inFile (use argv[1]): A text file contains a list of English words (strings), giving below
outFile1 (use argv[2])a text file includes
i) The completed sorted linked list, in ascending order.
//With caption indicating you are printing the original sorted list
ii) The reversed linked list.
//With caption indicating you are printing the reversed sorted list
outFile2( use argv[3]): All debugging outputs.
(Do not print this file in the hard copy!! )
string list in a text file:
Hishaam Esteban Kevin
Matthew Brandon
Joel Luis Jianwei Yechiel
Taeyong
Jiayu
Jiade Phillip
Russell Mohebullah
Akshar Evgeniia Andres Marco Justin
Robin Kelvin Zhiheng Jeffrey
Yifei Yinyu
Jiaxin Youyia Eleftherios
Yuan
Must have all the object classes as given below.
********************************
- listNode class
- data (string)
- next (listNode *)
methods:
- printNode (node) // use the format:
(this node data, this nodes memo address, next nodes memo address, next nodes data)
see print list example below.
- A linkedList class
- listHead (listNode *) // Initially it points to a dummy node
methods:
- constructLL ()
- findMiddleNode () // This method is not called in this project!
- reverseLL() // See algorithm steps below.
- moveSpotNodeToFront (listHead, Spot) // on your own!
// this method moves the node which is pointed by Spot to the front of the list.
// i.e., listHeads next is pointing to the node in the front of the list.
- 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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
