Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we need Deque data structures in the real world? [closed]

Can anyone give me an example of situation where a Deque data structure is needed?

Note - Please don't explain what a deque is?

like image 458
user366312 Avatar asked Oct 07 '10 09:10

user366312


People also ask

What is the need of dequeue in data structure?

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. insertLast(): Adds an item at the rear of Deque.

What is the purpose of the dequeue process?

What makes a deque different is the unrestrictive nature of adding and removing items. New items can be added at either the front or the rear. Likewise, existing items can be removed from either end. In a sense, this hybrid linear structure provides all the capabilities of stacks and queues in a single data structure.

What is the use of data structure in real life?

To store a set of fixed key words which are referenced very frequently. To store the customer order information in a drive-in burger place. (Customers keep on coming and they have to get their correct food at the payment/food collection window.) To store the genealogy information of biological species.


1 Answers

A Deque is a double ended queue, allowing inserting and removing from both ends.

In real scenario we can attached it to a Ticket purchasing line, It performs like a queue but some time It happens that some body has purchased the ticket and sudden they come back to ask some thing on front of queue. In this scenario because they have already purchased the ticket so they have privilege to come and ask for any further query. So in these kind of scenario we need a data structure where according to requirement we add data from front. And In same scenario user can also leave the queue from rear.

So it follows completely data structure of Deque.

like image 158
shiv.mymail Avatar answered Nov 03 '22 10:11

shiv.mymail