📃
Julianne's Knowledge Base
  • README
  • Home
    • Computer Science and Programming
      • Data Structures
        • Array
        • Binary Heap
        • Binary Tree
        • Deque
        • Dynamic Array
        • Graph
        • Hash Table
        • Linked List
        • Queue
        • Stack
      • Databases
        • Database Normalization
      • Networking
        • IP Protocol
        • Network Devices
        • OSI Model and TCP/IP
        • Ethernet LAN Switching
        • IPv4 Addressing
        • Sockets
      • Operating Systems
        • UNIX Operating Systems
          • Fundamentals
            • Virtualization
              • CPU Virtualization
              • Processes
            • Processes
          • xv6
      • Software Development
        • General Tips
        • My Goals as a Software Developer
        • Programming Languages
          • C
            • Memory Management in C
          • C++
            • I/O in C++
            • Iterators
            • Memory Management in C++
          • Javascript/TypeScript
            • Inheritance
            • React
            • Useful Libraries
          • Python
        • Tools
          • GDB
          • Git
    • Cooking
      • Diet and Nutrition
      • Recipes
    • Languages
      • Japanese
        • Grammar
        • Numbers and Counting
    • Productivity
      • Getting Things Done (GTD)
      • My GTD Trigger List
      • My Personal Knowledge Management System
      • Obsidian
        • Plugins
        • Using Obsidian
Powered by GitBook
On this page
  • What is it?
  • Examples in Technology
  • Basic Deque Operations
  1. Home
  2. Computer Science and Programming
  3. Data Structures

Deque

PreviousBinary TreeNextDynamic Array

Last updated 5 years ago

What is it?

A deque (also called a double-ended queue) is an ordered collection of items similar to a . There is a front and a rear, and operations primarily take place on the ends.

Unlike queues, deques allow for insertion and removal from both ends. Because of this, there is no requirement for them to follow FIFO or LIFO ordering (though they can if you decide to do so). It can be thought of as a combination of a stack and queue.

Examples in Technology

Some use cases for deques include:

  • Keeping track of web browser history

  • Keeping track of undo operations

  • Thread management

Basic Deque Operations

  • addFront(item): Adds an item to the front of the deque

  • addRear(item): Adds an item to the rear of the deque

  • removeFront(): Removes an item from the front of the deque

  • removeRear(): Removes an item from the rear of the deque

queue