Table of content

Deque in Rust

A deque, also known as a double-ended queue, is an ordered collection of items similar to the queue but It has two ends, a front, and a rear. We can add or remove the items from the front and read end of a Deque data structure.


Methods of Deque interface in rust

  • addFirst() : Inserts the specified element at the beginning of the Deque.
  • peekFirst() : Returns the first element of Deque, or null if the Deque is empty.
  • getFirst() : It returns the first element of the Deque.
  • removeFirst() : Returns and removes the first element of Deque.
  • addLast() : Inserts the specified element at the end of the Deque.
  • getLast() : It returns the last element of the Deque.
  • peekLast() : Returns the last element of Deque, or null if the Deque is empty.
  • removeLast() : Returns and removes the last element of Deque.
  • size() : Returns the number of elements present in Deque.
  • isDequeEmpty() : returns boolean True if the deque is empty otherwise false
Based on person to person the implementation and methods might change, only things remains the same is the concept of the deque
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions

Subscribe to See Videos

Subscribe to my Youtube channel for new videos : Subscribe Now