Reference no: EM131406412
Building a Dictionary with Array and Linked List
Write a program to implement a Dictionary of integers which consists of following methods:
- SortedArray(int a) : is a constructor which creates a dictionary of size a.
- void insert(int x) : Inserts element x at its proper position.
o Raise exception Dictionary_Full when dictionary is already full (in case of SortedArray)
o If x already exists, then raise exception Duplicate_Element_Found
- boolean delete(int x) : Deletes element x and returns true if x existed otherwise false.
o If x does not exists, the operation raises the exception Element_not_Found, which handles the exception by returning the predecessor and successor of x if x would have existed in the dictionary.
o If the dictionary is empty, it raises the Dictionary_Empty exception which handles it by returning a message "Dictionary Empty"
- boolean find(int x) : Returns true if x exists otherwise false and raises the exception Element_not_Found.
- void display() : Displays the dictionary's elements in order.
The input for the program must be from the file input.txt. For example, the input.txt might contain the following sequence of operations
I(5) // I for insert I(7)
I(5)
R(7) // R is used for delete F(12) // F for find
D // D is used for display
The output should be written in a file output.txt. For example, for the above sequence of inputs, the Dictionary will generate the following output:
Inserted Element 5
Inserted Element 7 Inserted Duplicate Element Element 7 Deleted
5
5
The assignment is divided into following parts:
PART A: Implement the dictionary using a sorted array. Here you will be required to implement find operation using binary search. The class name should be SortedArrayTable
PART B: Implement the dictionary using a sorted linked list. Here you will be required to implement find operation using only linear search. You could re-use the linked list class you implemented for COSC 2006. The class name should be SortedListTable.
What is net neutrality
: 1. What is Net neutrality? 2. Why is net neutrality such a hotly debated issue?
|
Explain the role of the brain in cognitive functions
: Write a two-page paper in which you explain the role of the brain in cognitive functions. As a part of your explanation, describe what Phineas Gage's accident revealed about how brain areas support cognitive function.
|
What is the coroutine linkage in operating system
: What's the coroutine linkage in Operating System? Can someone explain this concept in detail?
|
How are food supply impacted by increasing population size
: How are food supply and nutrition impacted by the increasing population size? When considering nutrition, do you think some countries will be more susceptible than others? Explain and support your answer.
|
Implement the dictionary using a sorted array
: COSC 2007 -Data Structures - Implement the dictionary using a sorted array. Here you will be required to implement find operation using binary search and Implement the dictionary using a sorted linked list.
|
Offshore outsourcing project management
: You are the project manager for a software development project. An offshore outsourcing firm will develop the software. What would you do during project initiation for an offshore-outsourced project that you might do differently for a project deve..
|
Crud-defining information ownership
: One easy way to determine information ownership is to think of CRUD-create, read, update, and delete. If you cannot only read but also create, update, and/or delete information, then in some way you own that information because you are responsible..
|
Explain the geographical impact with respect to health
: Explain the geographical impact with respect to health. Also consider the number of lives lost, environmental damage, economic fallout, and long-term repercussions or impact.
|
What type of car will meet your needs
: What type of car will meet your needs? Consider some of the following questions: What will you use your car for? Will you need it to haul anything? Will it need to seat more than two people?
|