Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92216211
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Given a list of numbers l a value x is said to be a

Given a list of numbers L, a value x is said to be a majority value if the value of over half the elements in L is x; in other words, if L has n elements and nx is the number of elements in L with value x, then x is a ma ...

Social sitessocial media is a common marketing tool and

Social Sites Social media is a common marketing tool and most site builders offer integration with major social media sites. Discuss at least two examples of what you would promote on social media from a web site that yo ...

Question the sunshine health corporation would like you to

Question : The Sunshine Health Corporation would like you to provide an updated explanation and reference guide on 802.11 standards and specifications. Briefly explain the advantages and disadvantages of each. If you loc ...

Question suppose that during the playing of the

Question : Suppose that during the playing of the coins-in-a-line game that Alice's opponent, Bob, makes a choice that is suboptimal for him. Does this require that Alice recompute her table of remaining Mi,j values to p ...

A chest has 3 drawers d1 has two silver coins s d2 has one

A chest has 3 drawers: (D 1 ) has two silver coins (S), (D 2 ) has one silver (S) and one gold (G), and (D 3 ) has two gold (G) coins. The drawer and coin were both randomly selected. Use the law of total probability to ...

A mail order supplier advertises same-day service on every

A mail order supplier advertises same-day service on every order. Recently, the movement of orders has not gone as planned. The director of customer service has completely redone the method of order handling. The goal of ...

Every day your friend commutes to school on the subway at 9

Every day your friend commutes to school on the subway at 9 AM. If the subway is on time, she will stop for a $3 coffee on the way to class. If the subway is delayed she skips the coffee and goes straight to class. The p ...

Describe an ethical conundrum found in a magazine or

Describe an ethical conundrum found in a magazine or newspaper article, and please give your own thoughts. Give good citations, of course.

Taylor found that 8 of the recipients of loans form a

Taylor found that 8% of the recipients of loans form a particular mortgage lender default within 3 years. If he takes a random sample of 736 customers who received loans 3 years ago, what is the average number of custome ...

Whats your answer about the equilibrium change from an

What's your answer about the equilibrium change from an event which decreases both demand and supply? You don't need to provide graph here. Just describe the curve shifts and how the equilibrium price and equilibrium qua ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As