About 285,000 results
Open links in new tab
  1. Deque in Python - GeeksforGeeks

    Mar 6, 2025 · A deque stands for Double-Ended Queue. It is a data structure that allows adding and removing elements from both ends efficiently. Unlike regular queues, which are typically operated on using FIFO (First In, First Out) principles, a deque supports both FIFO and LIFO (Last In, First Out) operations.

  2. Deque Implementation in Python - GeeksforGeeks

    Feb 13, 2025 · Deque in Python is implemented using a doubly linked list, making append and pop operations from both ends O(1) (constant time). Unlike Python’s built-in list (which uses a dynamic array), deque does not require shifting elements when inserting/deleting at the front.

  3. Python's deque: Implement Efficient Queues and Stacks

    Python’s collections module provides a class called deque that’s specially designed to provide fast and memory-efficient ways to append and pop item from both ends of the underlying data structure.

  4. Implementation of Deque Using List in Python - GeeksforGeeks

    Feb 12, 2025 · While Python provides a built-in collections.deque for optimized performance, a deque can also be implemented using lists. 1. Insertion at Rear (insertRear(x)): Adds an item at the rear of Deque. Checks if deque is full. Calculates the new rear index using (front + size) % cap. Inserts the element at the computed rear index.

  5. How to use deque in Python (collections.deque) | note.nkmk.me

    Apr 20, 2025 · In Python, the collections.deque class provides an efficient way to handle data as a queue, stack, or deque (double-ended queue). While the built-in list can be used as a queue, stack, or deque, collections.deque offers better performance, especially for adding or removing elements at the beginning.

  6. Understanding Python's deque - Python Central

    Python's collections module provides a powerful data structure called deque (pronounced "deck"), which stands for "double-ended queue." A deque is a generalization of stacks and queues, allowing you to add or remove elements from both ends efficiently.

  7. How to Use deque for Efficient List Operations in Python

    In Python, the collections.deque (double-ended queue) is a powerful data structure optimized for fast insertions and deletions from both ends. Unlike Python lists, which have an O (n) time complexity for insertions and deletions at the beginning, deque performs these operations in …

  8. Understanding and Using Deque in Python - CodeRivers

    Mar 17, 2025 · In Python, the deque (double - ended queue) is a powerful data structure provided by the collections module. It offers a convenient way to work with data that needs to be accessed and modified from both ends efficiently.

  9. Deque In Python (2025)

    deque (double-ended queue) in Python, from the collections module, provides optimized operations for appending and popping elements from both ends of the sequence.

  10. Python deque tutorial - mathspp

    Jan 18, 2024 · my_deque = deque() # Create a `deque`. my_deque.append(1) # Append an element to its end. my_deque.extend(range(2, 5)) # Extend the `deque` with more elements. popped_from_deque = my_deque.pop() # Pop an element from the end. There are two main differences between deque s and lists:

  11. Some results have been removed
Refresh