Tagged articles
10 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.

CData Structurealgorithm
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.

Producer ConsumerPythonQueue
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.

Data StructuresListPython
0 likes · 7 min read
Why Python’s deque Beats Lists for Fast Insertions: A Practical Guide
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
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.

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