Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(10 points) A group of $n$ dancers will be performing while while holding flags. It's optimal if each dancer is holding a flag as close

image text in transcribed

(10 points) A group of $n$ dancers will be performing while while holding flags. It's optimal if each dancer is holding a flag as close as possible to their height. You have a collection of $n$ flags of varying lengths and you want to assign a flag to each dancer such that you are minimizing the total difference in heights. That is minimizing $\sum_{i=1}^{n}\left|d_{i}-f_{i} ight|$ where $d_{i}$ is height of a dancer and $f_{i}$ is height of flag. Consider the following two strategies and prove or disprove that they work. 1. (5 points) Greedly, pick the dancer and flag that have the minimum difference in height. 2. (5 points) Sort the two lists and then assign the $i^{t h} $ dancer to the $i^{t h}$ flag. Does this algorithm work? If it doesn't, show a counter example. CS.VS.938|

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

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

Students also viewed these Databases questions

Question

Question What is a secular trust?

Answered: 1 week ago