Store array of sequential intervals I need to store a list of sequential intervals.
So for example I would to say:


{0-5} = a
{6} = b
{7-10} = c


and so on.
I need to add and remove items from this list:
.insert(d,{1,3})

will make our array:


{0} = a
{1-3} = d
{4-5} = a
{6} = b
{7-10} = c


Morehover you may need to check what items cover a range:
.itemsIn({6,8}) will return b,c.

I can keep an array with pointers to the same object instance for each value in a range but I suppose I can do a better job.
Interval tree?
If every interval begins immediately after the previous one ends, then you only need to store the start point of each interval (and the endpoint of the very last interval), which you can do with a self-balancing binary search tree.  Inserting and deleting intervals is then $O(\log n)$-time, and identifying the intervals overlapping a query interval is $O(\log n + k)$-time, if the answer includes $k$ intervals.