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

  Write the parametric form of the unit circle

Write the parametric form of the unit circle. Given an arbitrary positive integer n, write an algorithm that generates n evenly spaced points that are sampled along the unit circle

  Data analysis design for blogs

Consider the following H Base table design for blogs.  On the website, logged in users (who all have a unique, integer user ID) may comment on blog posts.

  Linked lists give a program to implement the insert

give a program to implement the insert operation and delete operations on a queue using linked

  Method singleparent returns number of nodes in binary tree

Write a method singleParent, which returns number of nodes in a binary tree that have only one child.

  Give the steps for to build priority queue after deque

Give the steps for to build priority queue after deque

  Determine if a string s is a palindrome

What data structure is most suitable to determine if a string s is a palindrome, that is, it is equal to its reverse.

  Find average in binary tree using preorder traversal

Find average in binary tree using preorder traversal example for the function - Provide answer this question with example.

  Advanced systems analysis and design

Produce a system specification indicating functional and non-functional requirements - Generate suitable prioritised Use Cases for the system.

  Give the time complexity of your algorithm

The input is the p programmes, for each i the number ai indicates the students from programme i, and the seating capacities of the q tables with table j seating bj people. Give the time complexity of your algorithm with a brief justification.

  Questionm about distributed database

Explain what a distributed database is and how replication works with respect to managing the information in these databases.

  Identify objects and classes and revise it to obtain a list

I already extracted problem statement and identified and revised some of them but still don't see they are ok. Please verify, to add or delete it. Also specify each of object and class such as (attribute, role played, simple value, event, tangibl..

  Saving contents of the richtextbox by creating a program

Create the statements to save the contents of the RichTextBox named rtbCurrent. Show a SaveFileDialog named sfdCurrent to get the name of the document from the user.

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