List of Words

For this project we will use linked lists to store the unsorted and sorted Words (there should be no arrays in this project.)

Create a class called WordNode which has fields for the data (a Word) and next (WordNode) instance variables. Include a one-argument constructor which takes a Word as a parameter. (For hints, see the PowerPoint on "Static vs. Dynamic Structures.)

public WordNode (Word w) { . . }

The instance variables should have private access. There will not be any get and set methods for the two instance variables.

Create linked list class called WordList. This should be a linked list with head node as described in lecture. Modify it so that the data type in the nodes is Word. The no-argument constructor should create an empty list with first and last pointing to an empty head node, and length equal to zero.

Include two methods in class WordList: append and insert. The append method will add the new node to the end of the list; the insert method will add the node in the proper position to keep the list sorted in order by Word.

Instantiate two linked lists, and for every Word read from the file, add it (if it is three letters) to the first list using append, and to the second list using insert. You will end up with the first list having the Words from the input file in the order they were read, and in the second list the Words will be in sorted order. Display the unsorted and sorted Words in the GUI just as in project 1.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.