I have a question can you help me??

In this assignment you are going to design and implement a Dictionary system that enables the user to efficiently add, remove, and search for words using a menu-driven system. The words will be organized as shown in figure 1 below. As you can see the system is a singly linked list of doubly linked lists. Read the technical details explained later to further understand how the system should behave. The completion of this assignment is heavily dependent on the exercises we did during the labs pertaining to singly and doubly linked lists.
This is going to be your second and last assignment for the semester and it is worth 10% of your final grade. Unlike the previous assignment, I’m going to give you the freedom to implement this task as you wish; of course your design strategy matters. I may suggest some structure that you can follow if you wish.

Technical Details:
• The system consists of three main entities: dictionary, letter, and word. Clearly, we need to create only one dictionary that consists of many letters, which in turn consist of many words. Initially we should have an empty dictionary, which means no letters and no words. The letters will be stored in a singly linked list and words in doubly linked lists. The justification for this design will be explained later.
• The dictionary entity has a field pointing at the first letter in the list. Each letter entity has three pointers: one pointing at the next letter, the second pointing at the first word and another pointing at the last word in the list. Each word entity has two pointers: one pointing at the previous, and another pointing at the next word in the list.
• Since there are 26 letters in the English alphabet, the maximum number of elements in the singly linked list is 26. To make things easier, we will assume that we are only dealing with lowercase letters (a  z).
• The letters in the singly linked list and the words in the doubly linked lists should be stored in an alphabetical order. So you can’t, for example, have the letter ‘e’ before ‘a’.
• The letter entity should have an additional field that keeps track of how many words start with this letter. So for example the letter ‘m’ in figure 1, should have this field = 4 because there are four words in this list.
• A letter should appear in the list only if there are words starting with it. For example, you can’t find the letter ‘a’ in figure 1 because there are no words starting with this letter.
• Once a letter is added to the list, it will never be removed even if we remove the words linked to it.

You must create a menu that enables the user to perform the following tasks in a similar manner to what we did in the lab. The tasks are:
1. Search for a specific word.
In this task the user will provide a word that you need to report whether it exists in the dictionary or not. Your search method should be efficient.
2. Add a new word.
In this task, the user will provide a new word to add it to the dictionary. You must add the new word in the correct DLL (under the correct letter) and in the correct alphabetical order. If the letter doesn’t already exist, you should add it. You should also increase the number of words which is a field stored in the letter entity.

3. Delete an existing word.
In this task, the user will provide a word to delete. Of course you will need to search for this word first and make sure it exists before you can delete it. You can use the search method of task 1 to complete this task. You need to decrease the number of words by one if the deletion is successful.
4. Report the number of words that start with a specific letter and print those words to the screen. You should give two options here: forward or backward print.
5. Print all the words that currently exist in the dictionary. Also print their total number.
The output for figure 1, for example, should look like this:

Total number of words: 10
c: cat, coin, cold
e: eye
m: man, mild, mom, myth
r: rain, rest


I suggest that you create four classes only: Dictionary, Letter, Word, and MainClass. You should be able to see now why I made the words in double linked lists; it’s because adding and deleting from DLLs is more convenient.

Votes + Comments
8 Years
Discussion Span
Last Post by Ancient Dragon
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.