3 ms·
A closely analogous problem which I have had to implement is the problem of drawing n overlapping events with varying duration on a timeline, coloring the event
by prawks 12y ago
A closely analogous problem which I have had to implement is the problem of drawing n overlapping events with varying duration on a timeline, coloring the event based on how many are underneath it.
Personally I find that a simpler problem to visualize, however it deals with almost the same information. Rather than what height to draw, you're keeping a count of how many events are underneath. You increment at each leading "critical point" and decrement at each ending one.
The problem presented here is nice because it requires thought on both the algorithm as well as the data structure. Very nice article.