Results 1 to 2 of 2

Thread: Deques

  1. #1
    Senior Member
    Join Date
    Jun 2015
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Deques

    A deque is a double-ended queue (hence its name). It is a container that holds elements in a linear structure. New elements can be inserted or deleted at either end. It is possible to access (and modify) any element of a deque quickly using array notation (e.g., D[4]). These containers incorporate features of stacks, queues, and vectors.

    To use a deque in your program, use the directive #include <deque> and declare your variables like this:

    deque<long> D;
    Here are the most important things you can do with a deque.
    Add elements To add a value to the back use D.push_back(e); and to add a value to the front use D.push_front(e);. The “front” of the deque is considered
    its beginning and the “back” is its end.

  2. #2
    Junior Member
    Join Date
    Dec 2018
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Deque or Double Ended Queue is a generalized version of Queue data structure that allows insert and delete at both ends. Operations on Deque: Mainly the following four basic operations are performed on queue: insertFront(): Adds an item at the front of Deque.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •