learnbyexample@programming.dev to Python@programming.devEnglish · 2 years agoClearing The Deque (exploring Python's deque data structure through a picture story)thepythoncodingstack.substack.comexternal-linkmessage-square3fedilinkarrow-up10arrow-down10
arrow-up10arrow-down1external-linkClearing The Deque (exploring Python's deque data structure through a picture story)thepythoncodingstack.substack.comlearnbyexample@programming.dev to Python@programming.devEnglish · 2 years agomessage-square3fedilink
minus-squarewosat@lemmy.worldlinkfedilinkEnglisharrow-up5·2 years agoYou can use a deque as a stack (First In, Last Out) or as a queue (First In, First Out). Lists are especially inefficient when adding/removing from the beginning of the list, but, for deques, it’s a O(1) operation.
You can use a deque as a stack (First In, Last Out) or as a queue (First In, First Out). Lists are especially inefficient when adding/removing from the beginning of the list, but, for deques, it’s a O(1) operation.