[docs] Explanation of deque
anatoly techtonik
techtonik at gmail.com
Thu Mar 19 16:58:50 CET 2015
Hi Broadus,
Interesting. I didn't pay attention that it doesn't support random
access. The documentation could be improved by separating the
description of data structure (a picture will be good) and its
implementation details.
On Thu, Mar 19, 2015 at 6:32 PM, Broadus Jones <broadus.jones at gmail.com> wrote:
> Hi. Anatoly,
>
> 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).
>
> --
> Broadus
>
> On Thu, Mar 19, 2015 at 6:04 AM, anatoly techtonik <techtonik at gmail.com>
> wrote:
>>
>> https://docs.python.org/2/library/collections.html#collections.deque
>>
>> 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
>> https://mail.python.org/mailman/listinfo/docs
>
>
--
anatoly t.
More information about the docs
mailing list