[docs] Explanation of deque
broadus.jones at gmail.com
Thu Mar 19 16:32:57 CET 2015
A deque is a structure that only supports adding to the front of the "line"
or back of the "line". While a queue is LILO (last in last out, or first
in, first out), a stack is LIFO (last in, first out) a deque allows pulling
from either end, but not the middle. I have never used one, so i cannot
speak to the use cases.
Examples:A queue could be a line at a bus stop or in front of a bank
teller. A stack would be a paper inbox on a desk or a gun clip. A deque
could be a section of water pipe, or a train tunnel through a mountain (the
train could stop and back out).
On Thu, Mar 19, 2015 at 6:04 AM, anatoly techtonik <techtonik at gmail.com>
> The documentation is detailed, descriptive, but.. it fails to answer
> the main question - what is deque?
> "Deques are a generalization of stacks and queues (the name is
> pronounced “deck” and is short for “double-ended queue”). Deques
> support thread-safe, memory efficient appends and pops from either
> side of the deque with approximately the same O(1) performance in
> either direction."
> I must say that I came to the point where I don't get what that means.
> Explaining the concept of double-ended queue or circular buffer with
> words like "thread-safe" and "memory efficient" is not helpful.
> anatoly t.
> docs mailing list
> docs at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the docs