Write a program that uses the divide-and-conquer technique

Assignment Help Data Structure & Algorithms
Reference no: EM131398385

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

This assignment is based on the Java program. In this assignment two task are assigned to perform one involve fining the total number of inversions in the array through divide and conquer mechanism. So a divide and conquer algorithm method merge sort is used to determine the number of inversion in the array. The second task involves determining the whether the two sets A and B are equal ie. all elements of A are in B a transform and conquer methodology is followed to determine whether the two sets are equal. The program is executed in eclipse and out is documented together with the coding

Reference no: EM131398385

Questions Cloud

Task environment of a retail clothing store : 1. Analyse the major forces in the task environment of a retail clothing store. 2. Devise a program that will help other managers and employees to better understand and respond to their store's task environment.
Propose a solution that will relieve friction in company age : Imagine that you work for a company with an age diverse workforce. You have baby boomers working with millenials. Their backgrounds are different, and how they view work is different. This is causing some friction within the workforce. Before the ..
Which countries can profit from ibm’s liebert sitescan : How are companies adopting solar power? Write a report summarizing your findings, and include a table of links to Web sites that provide additional details.
Discussion-organizational factors : Analyze and evaluate how organizational factors within an aviation operational organization (flight, maintenance, air traffic control, and airport) can have both positive and negative influences on safety within that organization. Discuss what tho..
Write a 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 - using a brute-force algorithm with efficiency class Θ(n2) will NOT be marked.
What was the issue in the case and what was courts ruling : What was the issue in the case and what was the court's ruling? Do you agree or disagree? Why? Be sure you provide a link to the case.
How considering objections help you clarify your perspective : Finally, consider the argument you have been developing for your writing assignments. How has considering objections helped you clarify your perspective
Standards of practice related to competency : What are some issues affecting standards of practice related to competency of medical care within rural hospitals? Can you please direct me to a few scholarly articles that defines and talks about such issues? Please do not include the Lyckholm an..
What values for c should you use in given equation : If you want to compute a .80, .92, or .98 confidence interval for µ when σ is known, and sampling is from a normal distribution, what values for c should you use in given Equation?

Reviews

inf1398385

3/10/2017 4:12:40 AM

Phenomenal expert, Finished my paper before time span. Exceptional work. I was bit confused with the requirements but undoubtedly this expert cleared all of my doubts. such a great team. thanks.

inf1398385

3/10/2017 4:10:22 AM

Can I have discount please I've been using this site for a while. I just want to make sure about the second program solution , the teacher has mentioned in the assignment fro the second question this: " Please note that a program using a brute-force algorithm with efficiency class T(n2) will NOT be marked." so my question is to the expert ! is the brute-force algorithm in the solution not T(n^2) ? if so , what kind of efficiency class T he will use. it is not T(n2) , it is O , or Big-theta. the simple doent show. I have used merge sort and binary search technique for second program. Not brute force.

len1398385

2/18/2017 12:09:02 AM

By using Java eclipse programming write the program questions provided Please note that a program using a brute-force algorithm with efficiency class T(n 2 ) will NOT be marked.

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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