News for hackers. Stuff that matters.
Re:Double-ended vector – is it useful? by asQuirreL on Monday May 23, 2016 @08:14AM (#11753325)
Yes, there are, but in my opinion, for it to be a circular buffer, it should wrap the end of the data back round to the front when the end of the queue reaches the end of the buffer.

Inserting 4 into:

    [x, x, x, 1, 2, 3]
Produces:

    [4, x, x, 1, 2, 3]
In a circular buffer, and:

    [x, 1, 2, 3, 4, x]
In the proposed "double-ended vector". The technique is different, the amortized complexity is also different. I think therefore, it warrants a different name, to avoid confusion.

There are no comments on this comment yet.