Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS QUESTION MUST BE ANSWERED WITH CLEAR ENGLISH PSEUDOCODE! You have N items for sale, numbered from 1 to N. Alice is willing to pay

image text in transcribed
THIS QUESTION MUST BE ANSWERED WITH CLEAR ENGLISH PSEUDOCODE! You have N items for sale, numbered from 1 to N. Alice is willing to pay alil> 0 dollars for item i, and Bob is willing to pay bi]>0 dollars for item i. Alice is willing to buy no more than A of your items, and Bob is willing to buy no more than B of your items. Additionally, you must sell each item to either Alice or Bob, but not both, so you may assume that N s A+B. Given NA,B,a1..N] and b[1..N], show that you can determine the maximum total amount of money you can earn in O(N log N) time. Hint: Suppose N- A B and pretend you wish to sell all items to Alice, but must choose B of them to give to Bob instead. Which ones do you want to give to Bob first? Then extend your approach to handle N

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago