P is for Practical | |
PerlMonks |
Re^3: Convex Hull Problemby code-ninja (Scribe) |
on Aug 27, 2013 at 09:59 UTC ( [id://1051107]=note: print w/replies, xml ) | Need Help?? |
No.
Events may overlap and in such a case, I'll have to select the one with the highest cost. Keep in mind that "cost" here refers to the income I'll get for each event. Consider my example.
The first event transcends the start of the third event, right? But I'm selecting the second because it does not clash with any other and gives me maximum cost. OTOH, if the input would've been:
The first even transcends the other two but I ignore it and select 2 4 9 because the event takes less time and is more profitable. I hope its clearer now. If not, let the problem statement rest and comment on the algorithm that I coded. I'll search for the exact problem statement and repost this question. My apologies, but this question bugs me periodically and for a while I get really intense about solving it and get carried away. :).
In Section
Seekers of Perl Wisdom
|
|