Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[10 marks] Greedy algorithm. Here is a special matching problem: given a set A of n numbers and a set B of n numbers, form

image text in transcribed

image text in transcribed

[10 marks] Greedy algorithm. Here is a special "matching" problem: given a set A of n numbers and a set B of n numbers, form pairs (a1,b1),,(an,bn), with {a1,,an}= and {b1,,bn}=B, so that the following cost function is minimized i=1n(aibi)2 Consider the following "greedy" strategy to solve this problem: pick the pair (a,b) with the smallest difference ab(aA,bB). Then remove a from A and b from B, and repeat. (a) Give a counterexample showing that this strategy is incorrect, i.e., it can sometimes give a non-optimal solution. Show your work! (b) Give another greedy strategy that will solve this special matching problem (detailed pseudocode is required). Prove that it always returns an optimal solution. Justify correctness and analyze running time

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

Students also viewed these Databases questions

Question

What is management growth? What are its factors

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago