Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can someone help me to solve it, please? P2) (25 pts) You have a list of songs S1, S2, S3, ..., Sn that you would

image text in transcribedcan someone help me to solve it, please?

P2) (25 pts) You have a list of songs S1, S2, S3, ..., Sn that you would like to download onto your MP3 player. The available disk space in our MP3 player would allow you to download all of these songs, but your budget would not. Assume that you can spend no more than D dollars, that the ith song S, costs di dollars, and that di SD. Assume that you want to maximize the number of songs that you download from that list within your D dollar budget. a. (15 pts) Describe a greedy strategy to select what songs to download. b. (10 pts) Write down your greedy algorithm (pseudo code). If you want to sort the data(actually you will), just write : Sort the songs in increasing order of cost or decreasing order of cost. i.e. you do not have to write the actual code for the sort algorithm. (similar to what we did in the class)

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

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

Stoneridge Inc. will go public on September 9 2014.

Answered: 1 week ago

Question

=+3. How does an agenda help make a meeting more successful? [LO-3]

Answered: 1 week ago