Tagged articles

deque

11 articles · Page 1 of 1
Deepin Linux
Deepin Linux
Oct 1, 2025 · Fundamentals

Why Deque Beats Vector and List: Inside the Double‑Ended Queue’s Magic

This article explains how the C++ deque combines the random‑access speed of a vector with the constant‑time double‑ended insertions of a list by using a segmented storage architecture, detailing its internal map, iterator mechanics, core operations, performance comparisons, practical use cases, and common pitfalls.

AlgorithmC++Data Structure
0 likes · 47 min read
Why Deque Beats Vector and List: Inside the Double‑Ended Queue’s Magic
Python Programming Learning Circle
Python Programming Learning Circle
Sep 6, 2025 · Fundamentals

Stop Reinventing the Wheel: Use Python’s Built‑In Queue for Fast, Thread‑Safe Tasks

Python developers often create simple queues with lists using append and pop(0), but this approach has O(n) complexity and thread‑safety issues; the article explains how the built‑in queue module provides efficient, thread‑safe FIFO, LIFO, and priority queues, with code examples for single‑thread and multithreaded task processing.

PythonQueuedeque
0 likes · 5 min read
Stop Reinventing the Wheel: Use Python’s Built‑In Queue for Fast, Thread‑Safe Tasks
Code Mala Tang
Code Mala Tang
Mar 1, 2025 · Fundamentals

Why Python’s deque Beats Lists for Fast Insertions: A Practical Guide

This article explains why Python lists are slow for head insertions and deletions, introduces the deque data structure from the collections module, compares their time complexities, and shows practical scenarios and code examples where deque provides superior performance and thread‑safety.

AlgorithmData StructuresPython
0 likes · 7 min read
Why Python’s deque Beats Lists for Fast Insertions: A Practical Guide
YiSu Grain
YiSu Grain
Oct 16, 2024 · Fundamentals

How to Build a Greenhouse Auto‑Control System in Python

This article walks through implementing a greenhouse automatic control system in Python, using a deque to store temperature‑humidity readings, defining a GreenhouseControlSystem class with methods for adding data, checking thresholds, and simulating the process, and explains the design choices.

OOPPythonSimulation
0 likes · 5 min read
How to Build a Greenhouse Auto‑Control System in Python
Test Development Learning Exchange
Test Development Learning Exchange
Jun 26, 2024 · Fundamentals

Python collections module: Counter, defaultdict, deque, namedtuple, ChainMap, custom containers, heapq, and LRU cache examples

This article introduces several useful classes from Python's collections module—including Counter, defaultdict, deque, namedtuple, ChainMap, UserList/UserDict/UserString, as well as heapq and an OrderedDict‑based LRU cache—explaining their purposes and providing ready‑to‑run code examples for each.

ChainMapCollectionsCounter
0 likes · 6 min read
Python collections module: Counter, defaultdict, deque, namedtuple, ChainMap, custom containers, heapq, and LRU cache examples
IT Services Circle
IT Services Circle
Apr 5, 2024 · Fundamentals

Huawei OD Interview Algorithm Problem – Basketball Game (Deque Simulation)

The article presents a Huawei OD interview problem where numbered basketballs are inserted into a linear bucket and can be removed from either end, describes the input and output formats, provides a simulation-based solution using double‑ended queues, and includes reference implementations in C++ and Java.

AlgorithmC++Simulation
0 likes · 9 min read
Huawei OD Interview Algorithm Problem – Basketball Game (Deque Simulation)
MaGe Linux Operations
MaGe Linux Operations
Jan 29, 2022 · Fundamentals

Master Python’s Powerful Containers: Counter, defaultdict, OrderedDict, deque & ChainMap

This article introduces Python’s collections module as a versatile alternative to built‑in containers, detailing the purpose, key methods, and practical code examples for Counter, defaultdict, OrderedDict, namedtuple, deque, and ChainMap, helping developers choose the right specialized container for their tasks.

ChainMapCollectionsCounter
0 likes · 11 min read
Master Python’s Powerful Containers: Counter, defaultdict, OrderedDict, deque & ChainMap
JavaEdge
JavaEdge
Nov 19, 2021 · Fundamentals

Master Sliding Window Maximum with Heap and Deque – Step-by-Step Solution

This article explains how to compute the maximum of each k‑sized sliding window over an integer array using both a priority‑queue (heap) approach and an optimized monotonic deque technique, complete with detailed walkthroughs, visual illustrations, and full Python code.

AlgorithmSliding Windowdeque
0 likes · 9 min read
Master Sliding Window Maximum with Heap and Deque – Step-by-Step Solution