4 ms·
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.
by sgtnoodle 4y ago
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-enjoyer 4y agoIf 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.