Program that uses the divide-and-conquer technique

Assignment Help JAVA Programming
Reference no: EM131398034

Question 1. Let a[0..n-1] be an array of n distinct integers. A pair (a[i], a[j]) is said to be an inversion if these numbers are out of order, i.e., i<j but a[i] > a[j].

For example: if array a contains the following numbers:
9, 8, 4, 5
then the number of inversions is 5.
(inversions are 9 > 8, 9 > 4, 9 > 5, 8 > 4, 8 > 5)
Write a program that uses the divide-and-conquer techniqueto count the number of inversion in the array.

Question 2. Given two sets of nunique integers A and B, determine if A is equal to B, i.e., all the elements of A are in B. Write a program that uses a transform-and-conqueralgorithm with efficiency class Θ(nlogn) to solve this problem.

Example #1: Enter the number of integers in the sets: 4
Enter the first set: 9 5 3 2
Enter the second set: 3 2 9 5
These two sets are equal.

Example #2: Enter the number of integers in the sets: 6
Enter the first set: 1 4 3 2 8 6
Enter the second set: 1 3 9 4 6 8
These two sets are not equal.
Please note that a program using a brute-force algorithm with efficiency class Θ(n2) will NOT be marked.

Verified Expert

The solution file is prepared in netbeans which contain two programs.They are counting inversion using divide and conquer algorithm and second one check two sets elements are equal using transform and conquer algorithm. Both program outputs are attached here with program.

Reference no: EM131398034

Questions Cloud

What do the four parts of the christian biblical narrative : What do the four parts of the Christian Biblical Narrative (i.e., creation, fall, redemption, and restoration) say about the nature of God and of reality in relation to the reality of sickness and disease? From where would one find comfort and hop..
What are the disadvantages of cloud computing : What business benefits do cloud computing\ services provide? What problems do they solve?
Did lees surrender at appomattox magnanimity to the defeated : Based on the evidence presented in this chapter, did Lee's surrender at Appomattox and Grant's magnanimity to the defeated forces save the nation from a drawn-out guerrilla war, as some historians have argued? Or, as other scholars have suggested,..
What are the five principles of fair information practices : What are the five principles of Fair Information Practices? For each principle, describe a business situation in which the principle comes into play and how you think managers should react.
Program that uses the divide-and-conquer technique : Write a program that uses the divide-and-conquer technique to count the number of inversion in the array and Write a program that uses a transform-and-conqueralgorithm with efficiency class Θ(nlogn) to solve this problem.
Left ventricle to the arcuate artery : Using a textbook as necessary, list the major arteries through these pathways in a human: a. Blood as it travels from the left ventricle to the arcuate artery.
In what way or ways did the shift to agriculture lead : In what way or ways did the shift to agriculture lead to a fundamental change in either relationships among humans (i.e., social complexity) or humanity's position via-a-vie the natural world. This could be in a positive or negative way (or both).
Evaluate their effectiveness with respect to certain areas : Describe specific experimentation and observational methods that could be used within your discipline to gather data. Include your rationale. Evaluate their effectiveness with respect to certain areas within your discipline.
Eight-ounce glasses of lemonade : How many kcalories are in 4 eight-ounce glasses of lemonade? What would you recommend that she drink instead?

Reviews

inf1398034

3/10/2017 4:08:14 AM

You really composed the paper! Straightforward with enough points of interest and conveyed it before due date. I'm awed. Incredible specifically addressed every one of my inquiries and didn't miss a one.

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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