Launch your tech mastery with us—your coding journey starts now!
Course Content
Data Structure

A Deque (pronounced “deck”) stands for Double-Ended Queue. Unlike a standard queue, it allows you to insert and delete elements from both the front and the rear ends.

Deque (Double-Ended Queue) data structure illustration showing elements A, B, C, D in a line with arrows indicating insertion and removal operations from both front and rear ends.

This flexibility makes Deque a hybrid structure that can function as both a Stack (LIFO) and a Queue (FIFO) depending on the operations used.

Common Operations:

  • addFirst() / addLast()
  • removeFirst() / removeLast()
  • peekFirst() / peekLast()