Implement the dictionary using a sorted array

Assignment Help Data Structure & Algorithms
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.

Verified Expert

The requirement was to implement sorted list of integers using arrays and linked list. It should have methods insert,delete,find and display. While inserting it should check if array is already full and raise an exception. It should raise exception for duplicate element also. During delete and find , it should raise an exception for no element found or array empty. Input and output should be through files.

Reference no: EM131406412

Questions Cloud

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?

Reviews

inf1406412

3/30/2017 4:58:49 AM

I need to give your group the greater part of the thanks on the planet for this! I will utilize your reasonable administrations again soon. Your organization is unprecedented, and I am truly thankful with all of you bailing me out with my task! Much thanks to you, SO VERY much!!!

inf1406412

3/30/2017 4:58:29 AM

ok I will pay this amount , but make sure if there is any wrong in the solution I will ask for that . tell the expert : read the assignment question carefully and do each point make a documentation to understand the code easily I want a 100% correct answer thank you first : the program should contain just two classes which is SortedArrayTable and SortedListTable, put the all exceptions in the main class second: the program should read from a txt file as it mentioned in the assignment question file Can I know how to get the program reads from the txt file ? I tested the program and there is some little mistakes when the program insert the second 5 , it should display a duplicate element ,as it shown in the assignment question I attached a screenshot please fix asap the deadline is after 24 hours

len1406412

2/27/2017 2:52:48 AM

I would like to get this assignment by java code and also I want 100% correct solution If cannot do it just tell me from now if I receive a wrong solution I want to get my money back I attach a file that have all details of the question , please don''t forget anything , thank you

Write a Review

Data Structure & Algorithms Questions & Answers

  Create a table that depicts the runtime for arrays

Create a table that depicts the runtime for arrays of length 1 to 10. Would you expect the general runtime to be O(n), O(n2), O(n3), or some other function of n? Explain.

  Describe how the end-of-file method is used when reading

question 1 explain how the end-of-file method is used when reading data from a sequential file. provide a c code

  Discuss the ways in which yfile can optimize to reduce size

Discuss the ways in which you can optimize a file in order to reduce file size and maintain quality.

  What does a computer know about a declared array?

What does a computer know about a declared array?

  Find a shortest-path from u to v

find a shortest-path from u to v, and we have a *valid* heuristic, i.e.: For every node w, we have a value a(w) such that the distance from w to v in G is at least a(w) for all nodes w.

  Do you observe any changes in cluster memberships

Draw the graphic for the healthy set, representing the values, healthy and unhealthy and what is the degree of membership to the fuzzy set healthy of person B who has a BMI of 26.2? And to the fuzzy set unhealthy?

  Create algorithm prompt for and receive employee number

Create algorithm which will prompt for and receive the employee number from operator at terminal. Your program is to search array of valid employee numbers to check that employee number is XXXXX,

  You need to find the smallest array and see a segment fault

Write me a function that finds the smallest item in an ArrayBag (by reference) and returns true if the arrayBag is not empty and false otherwise.

  Create a program could perform over an array of items

Create a program could perform over an array of items that would be used by a small business. Your task must include the following: Declaring array, Populating the array and Processing the items in the array.

  Construct the weight vector of the maximum margin hyperplane

Construct the weight vector of the maximum margin hyperplane by inspection and identify the support vectors - how many leaf nodes can a decision tree have if it is consistent with a training set containing 100 examples?

  Design and code your own lifo stack using single liked list

Design and code your own LIFO Stack using single liked list to hold a list of integers. Use the C++ "struct" structure to create your SLL nodes. Node position numbering should start with one.

  Cache memory mapping function

Consider a cache consisting of 256 blocks of 16 words each, for a total of 4096(4k) words and assume that the main memory is addressable by a 16 bit address and it contains of 4k blocks. How many bits are there in each of the TAG, BLOCK/SET and WORD ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd