I have a set of events with start and end times. I want to render them as long boxes in a series of rows with no overlap, something like this
00:00 01:00 02:00 03:00 04:00 05:00 06:00 07:00 08:00
--|--------|--------|--------|--------|--------|--------|--------|--------|--
AAAAAAAAAAAA BBBBBB CCCCCCCCCCCCCCCCCCCC DDDDDDDDDDDD
--|--------|--------|--------|--------|--------|--------|--------|--------|--
EEEEEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
--|--------|--------|--------|--------|--------|--------|--------|--------|--
GGGGGGGGGGGGGGGGGGG HHHHHHHH IIIIIIIIIIIII
--|--------|--------|--------|--------|--------|--------|--------|--------|--
The assignment of any particular box to any particular row isn't important. What I want is an algorithm which will pack these boxes into the smallest number of rows.
Is there a known algorithm for this?