Brahim
Brahim

Reputation: 838

Finding a greedy optimal solution

Is there a greedy algorithm to solve this problem: I have n television, each television has a height and a width. r buyers come at the same time to my shop. Each one wants a television with a known minimum height and a minimum width.

What is the maximum number of commands I can fulfill?

Upvotes: 0

Views: 103

Answers (1)

Harman
Harman

Reputation: 1581

The problem is of maximum graph matching. You create a graph with left side nodes representing customers and right side nodes representing televisions. A edge between left side node and right side node represent that customer can buy television(meaning television passes the minimum height- width requirement of customer). Now you have to find maximum matching in the graph.

Upvotes: 2

Related Questions