On 6/26/19 11:59 AM, William Ray Wing via Tutor wrote: > One of the most useful (to me) structures is the double-ended queue ("from > collections import deque”). It creates a queue that can quickly remove an > item from one end and add an item to the other. Particularly useful for > displaying a sliding window into time series data, or a moving track of the > most recent n observations of a physical measurement. > > Bill
Indeed. deques are often implemented using double-linked lists, the Python version is (though you can't get at the details easily). I forgot to add the snide-comment part of "what are these good for": (a) binary search trees are excellent for Computer Science professors who want to introduce recursion into their classes. (b) all the classic data structures are candidates for being job interview questions ("implement a linked list in Python on the whiteboard") _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor