Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

For the OrdArray class in the orderedArray.java program (Listing 2.4 on page 59), you are asked to add the following methods

  • A merge() method so you can merge two ordered source arrays into an ordered destination array. To simplify, for duplicate values (no mater in an array or two arrays), only count once.
  • A common() method so you can get the common values owned by the two ordered source arrays into an ordered destination array. For duplicate values, only count once.
  • Using theobjected oriented analysis and design, using the available insert(), find(). delete() and display() methods.
  • You cannot use any available library.

Write code in main() of class OrderedApp that inserts some random numbers into the two source arrays, invokes merge() and common() and displays the contents of the resulting arrays. The source arrays may hold different numbers of data items. In your algorithm you will need to compare the keys of the source arrays, picking the smallest one to copy to the destination. You'll also need to handle the situation when one source array exhausts its contents before the other.

Example:

Source array A = {3, 6, 8, 8, 11, 17, 25, 34, 38, 46, 48, 48, 48, 57, 62, 69, 72, 72, 77, 83};

Source array B = {5, 8, 14, 25, 31, 37, 41, 48, 48, 52, 77, 82, 94};

Then, Destination array C (after merge) = {3, 5, 6, 8, 11, 14, 17, 25, 31, 34, 37, 38, 41, 46, 48, 52, 57, 62, 69, 72, 77, 82, 83, 94};

Destination array D (after common) = {8, 25, 48, 77}; 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92676913
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Question squareroot write a function to determine the

Question : squareroot Write a function to determine the squareroot of a number. The squareroot of a number can be approximated by repeated calculation using the formula NG = 0.5(LG + N/LG) where NG stands for the next gu ...

Question suppose users share a 3 mbps link through circuit

Question : Suppose users share a 3 Mbps link through circuit switching. Also suppose each user requires 150 kbps when transmitting, but each user transmits only 10 percent of the time. a) How many users can be supported? ...

Question a tank for propane gas is a cylinder with

Question : A tank for propane gas is a cylinder with hemispheres at each end. Write a process that asks the user to enter the length of the cylinder and the radius of the cylinder (same as the radius of the hemisphere (s ...

Listen to or read the transcript of this podcast

Listen to (or read the transcript of) this podcast (https://www.stlouisfed.org/education/economic-lowdown-podcast-series/episode-16-elasticity-of-demand) from the Federal Reserve Bank of St. Louis. describe your experien ...

When a 5606g sample of walnuts is burned with excess oxygen

When a 56.06g sample of walnuts is burned with excess oxygen in a bomb calorimeter with a heat capacity of 23.25kJK-1. The temperature of the calorimeter rises fro 17.78C to 94.57C. What is the (Delta)U(rxn) value, in un ...

Calculate the thinkness of the monolayer assuming that the

Calculate the thinkness of the monolayer assuming that the volume of the monolayer is 7.39×10-6 mL and diameter of the watch glass is 5 cm.

Restaurant management database project the restaurant

Restaurant Management Database Project : The restaurant maintains the catalog for the list of food and beverage items that it provides. Apart from providing food facility at their own premises, the restaurant takes order ...

Diacussion 1 how would one distinguish between an

Diacussion: 1) How would one distinguish between an organizational weekness and threat to the organization? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow the APA for ...

Examine the us passenger airline industry using the five

Examine the U.S. passenger airline industry using the five forces. Is this an attractive industry? Why or why not?

Assignmentroyal wallace a uk-based transportation company

Assignment Royal Wallace, a UK-based transportation company, is a global leader in the rail equipment and servicing industry. Its wide-range of products includes passenger rail vehicles and total transit systems. It also ...

  • 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