Source arrays into an ordered destination array

Assignment Help Basic Computer Science
Reference no: EM131848554

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}; 

Reference no: EM131848554

Questions Cloud

Summarize the principles of professional conduct : Read the AICPA Code of Professional Conduct. In 3-4 pages (12-pt type, double-spaced), summarize the following sections of the Code.
Software developers has a set of permissions : A common use of bitwise operators is the use of bit fields. If you and your team of software developers has a set of permissions
What price will you pay for it : Suppose that today’s date is April 15. If you buy the bond from a dealer today, what price will you pay for it?
Research the history of the pipe and filter style of command : Research the history of the pipe and filter style of commands. In a 2- to 3-page report, explain the strengths and limitations of the approach.
Source arrays into an ordered destination array : For the OrdArray class in the orderedArray.java program (Listing 2.4 on page 59), you are asked to add the following methods
What will be approximate capital gain of this bond : what will be the approximate capital gain of this bond over the next year if its yield to maturity remains unchanged?
Research potential hris types and hris vendors : Research potential HRIS types and HRIS vendors that may suit the needs for Mr. Bell and Gladwell Grocery Stores.
Department the person works in : The first line contains a person's first name, last name, and the department the person works in.
Evaluates difference between leadership and board governance : Write a 700- to 1,050-word paper that evaluates the difference between leadership and board governance in establishing strategic planning for a health care orga

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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