Lurker News
Back to discussion

Comment by sgtnoodle

sgtnoodle1 reply#
Neat, it's always best to look at the source. To be clear, a deque can be implemented on top of an array and still have constant time operations on the head.
sicp-enjoyer1 reply#
If it's not constant time on both ends, it's not a deque. You can already insert items at any index in an array with linear cost.
sgtnoodle1 reply#
I invite you to think about the problem for a while, and try to think of a way to implement a performant deque on top of a resize-able array. I promise you it's possible.
eru#
I don't think the comment you replied to disagreed with that.