answersLogoWhite

0

What is the need of deque?

Updated: 8/10/2023
User Avatar

Wiki User

9y ago

Best Answer

A double ended queue (or deque ) is a queue where insertion and deletion can be performed at both end that is front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion). So when we need to insert or delete at both end we need deque.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

A double ended queue (or deque ) is a queue where insertion and deletion can be performed at both end that is front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion)

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

I checked my dictionaries, my computer and my phone for a definition for that word. I believe there are no such word is dequ.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the need of deque?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Explain The merits of using a deque to implement a stack in data structure?

Explain The merits of using a deque to implement a stack in data structure


Write a algorithm for a deque operations?

please read data structure (schaum series) books


A program for queue ADT by using arrays in c plus plus?

Arrays are not suitable for implementing queues because while they are ideal for adding to the end, the are not ideal for extraction from the beginning. For that you need a deque. Regardless, the STL (standard template library) already provides an efficient queue ADT in std::queue.


What is a double ended queue?

A double ended queue, or deque, is a queue in which you can access or modify both the head and the tail. The front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion)


C program for the two dimensional array repesentation of priority queue?

//implement double ended queue using array. #include<stdio.h> #include<conio.h> #define SIZE 20 typedef struct dq_t { int front,rear; int item[SIZE]; }deque; /********** Function Declaration begins **********/ void create(deque *); void display(deque *); void insert_rear(deque *, int); void insert_front(deque *, int); int delete_front(deque *, int); int delete_rear(deque *, int); /********** Function Declaration ends **********/ void main() { int data,ch,x; deque DQ; clrscr(); create(&DQ); printf("\n\t\t Program shows working of double ended queue"); do { printf("\n\t\t Menu"); printf("\n\t\t 1: insert at rear end"); printf("\n\t\t 2: insert at front end"); printf("\n\t\t 3: delete from front end"); printf("\n\t\t 4: delete from rear end"); printf("\n\t\t 5: exit. "); printf("\n\t\t Enter choice :"); scanf("%d",&ch); switch(ch) { case 1: if (DQ.rear >= SIZE) { printf("\n Deque is full at rear end"); continue; } else { printf("\n Enter element to be added at rear end :"); scanf("%d",&data); insert_rear(&DQ,data); printf("\n Elements in a deque are :"); display(&DQ); continue; } case 2: if (DQ.front <=0) { printf("\n Deque is full at front end"); continue; } else { printf("\n Enter element to be added at front end :"); scanf("%d",&data); insert_front(&DQ,data); printf("\n Elements in a deque are :"); display(&DQ); continue; } case 3: x = delete_front(&DQ,data); if (DQ.front==0) { continue; } else { printf("\n Elements in a deque are :"); display(&DQ); continue; } case 4: x = delete_rear(&DQ,data); if (DQ.rear==0) { continue; } else { printf("\n Elements in a deque are :"); display(&DQ); continue; } case 5: printf("\n finish"); return; } } while(ch!=5); getch(); } /********** Creating an empty double ended queue **********/ /********** Function Definition begins **********/ void create(deque *DQ) { DQ->front=0; DQ->rear =0; } /********** Function Definition ends **********/ /********** Inserting element at rear end **********/ /********** Function Definition begins **********/ void insert_rear(deque *DQ, int data) { if ((DQ->front 0) { printf("\n Underflow"); return(0); } else { DQ->rear = DQ->rear -1; data = DQ->item[DQ->rear]; printf("\n Element %d is deleted from rear:",data); } if (DQ->front==DQ->rear) { DQ->front =0; DQ->rear = 0; printf("\n Deque is empty(rear end)"); } return data; } /********** Function Definition ends **********/ /********** Displaying elements of DEQUE **********/ /********** Function Definition begins **********/ void display(deque *DQ) { int x; for(x=DQ->front;x<DQ->rear;x++) { printf("%d\t",DQ->item[x]); } printf("\n\n"); } /********** Function Definition ends **********/

Related questions

Explain The merits of using a deque to implement a stack in data structure?

Explain The merits of using a deque to implement a stack in data structure


What is difference between enque and dequeue?

deque


How do you write a program to delete elements at both ends of a deque using C plus plus?

The C++ STL (Standard Template Library) provides a std::deque template specifically for this purpose: std::deque<int> deq {}; // default construct an empty deque of type int deq.push_back (42); // deq = {42} deq.push_front (0); // deq = {0, 42} deq.push_back (100); // deq = {0, 42, 100} deq.pop_front (); // deq = {42, 100} deq.pop_back (); // deq = {42} As with all other STL containers, any type or class that can be copy or move constructed can be placed in a std::deque, including other STL containers (even std::deque itself).


Program to delete elements at both ends in a dequeue using c plus plus?

#include<deque> std::deque<int> deq; deq.push_back (42); deq.pop_back (); deq.push_front (0); deq.pop_front ();


Write a algorithm for a deque operations?

please read data structure (schaum series) books


What is the birth name of Danny Demanto?

Danny Demanto's birth name is Daniel C. DeQue.


What do you understand by deque?

A double ended queue (or deque ) is a queue where insertion and deletion can be performed at both end that is front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion)


Which data structure allows deletion from both ends and insertion only from one end?

Deque double ended queue


What has the author Nicolaus written?

Nicolaus has written: 'Tractatus sacerdotalis de sacramentis deque divinis officiis et eorum administratibus'


C program to implement deque using circular linked list?

You'll need to use a doubly-linked circular list, since otherwise when you pop off the tail element you'll need to whizz all the way round the list to find its predecessor. See the links section for an implementation of a doubly-linked circular list.


A program for queue ADT by using arrays in c plus plus?

Arrays are not suitable for implementing queues because while they are ideal for adding to the end, the are not ideal for extraction from the beginning. For that you need a deque. Regardless, the STL (standard template library) already provides an efficient queue ADT in std::queue.


What has the author Philipp Marbach written?

Philipp Marbach has written: 'Assertiones theologicae de Sancta Cruce deque vsu ac veneratione imaginum' -- subject(s): Religious disputations