Design an algorithm that computes the compatibility

Assignment Help Data Structure & Algorithms
Reference no: EM132268218

Assignment -

Description - Suppose we are running a bed manufacturing company. There are several different types of bed of various dimensions (length and width) that we can produce. To decide which beds we should produce, we run a market survey asking people what dimensions they require in a bed (i.e. the minimum length and the minimum width they need). We say that a person is compatible with a bed type if its length is at least that person's length requirement, and its width is at least that person's width requirement. The compatibility of a bed type is the number of persons compatible with it. Our goal is to determine efficiently the compatibility of every bed type.

We now state the problem more formally. Suppose we have n bed types, and surveyed n persons. Let B = {b1, . . . , bn} be a set of n points in 2-dimensional space representing the dimensions of the bed types. We write bi = (bi(x), bi(y)) with bi(x) representing the length of bed type i and bi(y) its width. Similarly, we represent the requirements of the n persons with P = {p1, . . . , pn}, a set of n points in 2-dimensional space, and we also write pj = (pj(x), pj(y)) where pj(x) and pj(y) are person j's length and width requirements, respectively.

Point bi is compatible with point pj if and only if bi(x) ≥ pj(x) and bi(y) ≥ pj(y). The compatibility of bi is the number of points of P that it is compatible with and we write comp(bi) = k if it is compatible with k points of p. See Figure 1 for an illustration.

440_figure.png

Figure 1: The solid circles represent points in B and the hollow circles represent points in P. The numbers represent the compatibility of each points in B.

Your task is to design an algorithm that computes the compatibility of every point in B.

Task 1: 1-dimensional case

We will start with the simpler 1-dimensional case, that is, P = {p1, . . . , pn} and B = {b1, . . . , bn} are points in 1-dimensional space (multiple points may have the same value). Your task is to design an O(n log n) time algorithm that computes the compatibility of each point in B with P.

(a) Description of how your algorithm works ("in plain English").

(b) Argue why your algorithm is correct.

(c) Prove an upper bound on the time complexity of your algorithm.

(d) Implement your algorithm (in Ed) (see the appendices for the data formats).

Task 2: 2-dimensional case

Consider the same problem in 2D, that is, let P = {p1, . . . , pn} and B = {b1, . . . , bn} be a set of points in 2-dimensional space, where each point pi is a 2-tuple pj = (pj(x), pj(y)) and bi = (bi(x), bi(y)). The task is to solve this problem using a divide-and-conquer approach. A divide and conquer algorithm works by recursively breaking down a problem into two (or more) sub-problems of the same or related type, until these become simple enough to be solved directly. The solutions to the sub-problems are then merged to give a solution to the original problem. For full marks on this question the algorithm is required to run in O(n log n) time.

We will start with the merge step.

(a) Merge step - Consider a vertical line L. Suppose the line splits P into two sets P1 = {p1, . . . , pl} and P2 = {q1, . . . , qn-l}, where P1 lies to the left of L and P2 lies to its right. Similarly, it also splits B into two sets B1 = {b1, . . . , bm} and B2 = {c1, . . . , cn-m}. We will also assume that the sets in P1 and P2, B1 and B2 are ordered from bottom to top (in case of a tie the points are ordered with respect to increasing x-coordinates). Assume that the problem has been solved for (P1, B1) and (P2, B2), respectively. That is, the compatibility of each points in B1 has been computed with respect to P1 and the compatibility of each point in B2 has been computed with respect to P2. Your task is to combine the two solutions into one solution for P = P1 ∪ P2 and B = B1 ∪ B2 in O(n) time. An example is shown in Fig. 2.

(i) Description of how your algorithm works ("in plain English").

(ii) Argue why your algorithm is correct.

(iii) Prove an upper bound on the time complexity of your algorithm.

(iv) Implement your algorithm (in Ed) (see the appendices for the data formats).

1420_figure1.png

Figure 2: The point sets P1, B1 are separated from P2, B2 by a vertical line. The merge step merges the input data into the compatibility of all the points in B = B1 ∪ B2 with respect to points P = P1 ∪ P2.

(b) The final task is to use the merge step algorithm from (a) to construct a divide-and-conquer algorithm for the problem.

(i) Description of how your algorithm works ("in plain English").

(ii) Argue why your algorithm is correct.

(iii) Prove an upper bound on the time complexity of your (entire) algorithm.

(iv) Implement your algorithm (in Ed) (see the appendices for the data formats).

Attachment:- Assignment File.rar

Reference no: EM132268218

Questions Cloud

How analyzing glass fractures can assist investigators : You are required to write an essay explaining in detail how you reached this conclusion to include a discussion about how glass fractures.
Calculate the average access delay for a drive : Calculate the average access delay for a drive with HTH switching time of 3 ns, 6 R/W heads
The development of the department of homeland security : A potential problem that might exist with the development of the Department of Homeland Security (DHS) is the notion many of the departments.
Type of membership based on the amount of points : Python program with if-elif-else structure that can decide the type of membership based on the amount of points entered by the user:
Design an algorithm that computes the compatibility : Your task is to design an algorithm that computes the compatibility of every point in B. Description of how your algorithm works
Words smurf attacks-password cracking : By providing these words Smurf attacks, password cracking, social engineering, spoofing or phishing attacks
Compare the hurricane katrina and hurricane sandy : Compare and contrast the responses to Hurricane Katrina and Hurricane Sandy (also called Superstorm Sandy).
How would a cloud-based service save money : How would a cloud-based service save money vs having a Data Center? Would it be cost effective to do Hybrid Cloud? Public Cloud? Private Cloud?
What would be the best strategy be for your group to engage : How would a group of citizens assess the needs of the community and critically analyze what resources they have and need to make a positive impact?

Reviews

len2268218

3/28/2019 12:09:42 AM

Please see the Programming assignment attached. Submission details - Submit your answers to Tasks 1a-c, 2a(i-iii), and 2b(i-iii) as a single document to Canvas. Your work must be typed (no images of text, although you can use diagrams if you think it helps.) Please try to be reasonably concise. The implementation required for Tasks 1d, 2a(iv) and 2b(iv) should be done in Ed, and submitted via Ed. Please be aware that there may be hidden tests, and additional tests may be added after the submission deadline. Your report will be subject to automatic and manual plagiarism detection systems. Remember, it’s acceptable to discuss high level ideas with your peers, but you should not share the detail of your work, such as parts as the precise algorithms, examples, proofs, writing, or code. To facilitate anonymous grading, please do not write your name on your submission.

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