Welcome to Live Chat

Welcome to LiveWebTutors Services, World's leading Academic solutions provider with Millions of Happy Students.

Call Back

24x7 Support Available

chat now

In A Hurry? Get A Callback

### shopping cart 0

Subject Solutions Code Description Price Delete

## 1. (50 points) 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

#### Question Preview:

1. (50 points) Let a[0..n-1] be an array of ndistinct integers. A pair (a[i], a[j]) is said to be an inversion if these numbers are out of order, i.e., i< jbut a[i] > a[j]. For example: if array acontains 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. 2. (50 points) Given two sets of nuniqueintegers A and B, determine if A is equal to B, i.e., all the elements of A are in B. Write...

View Complete Question >>

#### Question Preview:

1. (50 points) Let a[0..n-1] be an array of ndistinct integers. A pair (a[i], a[j]) is said to be an inversion if these numbers are out of order, i.e., i< jbut a[i] > a[j]. For example: if array acontains 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. 2. (50 points) Given two sets of nuniqueintegers 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.

View Less >>

## Solution Preview

Solution:
CountingInversion.java
import java.util.Scanner;
public class CountingInversion
{
/*
* This function continuously divides the array into two equal halves.
* Determine the number of inversions in each small sub array
* and then determine the total inversion count in the array
* This algorithm is similar to merge sort algorithm which uses divide and conquer
methodology

Get solution

#### \$20

Orginal Price : \$26.0

Pay Now

250 words

Don’t delay more, place your order now. Quick assignment help will be offered to you.

Order Now

## CUSTOMER REVIEWS

### Excellent

Based on 702 reviews See all reviews here

### One of the Best Service

I trust LiveWebTutors for my assignments because of their ability to deliver the perfect assignments time and again. Only a few of my assignments required minor revisions. The rest assured it is the best assignment writing service in the market.

Elizabeth
Sydney

### Great Service and on time

I felt so exhausted and burdened with the large number of assignments I had to write and desperately needed someone to help me with all the writing and there was LiveWebTutors company on the internet. They finished my assignments before the due date and also offered me a first-timer discount.

Christina
Perth

### One of the Best Assignment Provider

I ordered my Mathematics and Marketing assignments from them last month. I received the content on the set date. Most importantly, the assignments were well-written and plagiarism free. I scored a top grade for the assignment written by them. They are a reliable company.

Oli
Brisbane