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

  Prove every triangulated cycle graph a tree decomposition

We say that a graph G = (V, E) is a triangulated cycle graph if it consists of the vertices and edges of a triangulated convex n-gon in the plane-in other words, if it can be drawn in the plane as follows. Prove that every triangulated cycle graph ..

  Write a sortedinsert function in c program

Write a sortedInsert() function in C program that takes two parameters: a list that is sorted in increasing order, and a single node,

  Time n-processor common crcw pram algorithm

present an O(1) time n-processor common CRCW PRAM algorithm for computing the boolean AND of n bits.

  Write me the simplified php code to execute this flow chart

It requires that you test a varibale, and if it has one value, you execute the first loop, and if it has the seccond value, you execute the second loop. your is to write me the simplified PHP code to execute this flow chart

  Create an array in vl with up to hundrad elements

Create an array in VL with up to 100 elements, call it Username[100]. Do the following: Prompt user for a name to check, or enter Stop to end, both in quotes.

  Find the longest monotonically

Describe an O(n) time algorithm that, given a set S of n distinct numbers and a positive integer k ≤ n, determines the k numbers in S that are closest to the median of S.

  Provide polynomial-time algorithm to decide in graph

Provide a polynomial-time algorithm to decide whether G has unique minimum s - t cut (i.e., an s - t cut of capacity strictly less than that of all other s - t cuts).

  Different network connections

Use your laptop at public store to check your email and discuss all the different network connections involved in this operation.

  Write program for computing of shortest trajectories in abg

Write a program for computation of the shortest trajectories in ABG. Set X (a 2D table with or without obstacles), an element p for which the trajectories should be calculated.

  Algorithm to recognize substrings which form numbers

Given the string of numbers, recognize all the substrings which form numbers which are divisible by 3. For instance, applying algorithm on the string.

  Create an interface to create your calculator

You will need to (1) Create an interface to create your calculator, and (2) implement the calculator code. I want you to use a standard linked list (not array) to do this assignment.

  Problem 1 n vehicles occupy squares 1 1 through n 1 ie the

problem 1. n vehicles occupy squares 1 1 through n 1 i.e. the bottom row of an n times n grid. the vehicles must be

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