SlideShare une entreprise Scribd logo
1  sur  18
PRESENTED BY
  Chandramohan.R
    Manoranjani.K
      Racchana.K
    Rosalin Mary.S
 Saddam Hussain .J
Double-Ended Queue


 A Deque or deck is a double-ended queue.

 Allows elements to be added or removed on either the
 ends.
TYPES OF DEQUE
 Input restricted Deque
 Elements can be inserted only at one end.

 Elements can be removed from both the ends.



 Output restricted Deque
 Elements can be removed only at one end.

 Elements can be inserted from both the ends.
Deque as Stack and Queue
As STACK

 When insertion and deletion is made at the same side.



As Queue

 When items are inserted at one end and removed at the other
  end.
OPERATIONS IN DEQUE

 Insert element at back

 Insert element at front

 Remove element at front

 Remove element at back
Insert_front

 insert_front() is a operation used to push an element into the
  front of the Deque.

      PUSH 0           1     2       3   4       5       7




               FRONT                         REAR




                       0         1   2   3   4       5       7
Algorithm Insert_front
step1. Start
step2. Check the queue is full or not as if (r == max-1) &&(f==0)
step3. If false update the pointer f as f= f-1
step4. Insert the element at pointer f as Q[f] = element
step5. Stop
Insert_back
 insert_back() is a operation used to push an element at the
  back of a Deque.

                     1    2       3       4       5       7   PUSH 9




             FRONT                            REAR




                     1    2   3       4       5       7
Alogrithm insert_back

Step1: Start

Step2: Check the queue is full or not as if (r == max-1)
       &&(f==0) if yes queue is full

Step3: If false update the pointer r as r= r+1

Step4: Insert the element at pointer r as Q[r] = element

Step5: Stop
Remove_front

 remove_front() is a operation used to pop an element on front
  of the Deque.
            POP       1   2       3   4   5        7




                     FRONT                    REAR




                              2   3   4   5    7
Alogrithm Remove_front

Step1: Start

Step2: Check the queue is empty or not as if (f == r) if yes queue is
        empty.

Step3: If false update pointer f as f = f+1 and delete element at
        position f as element = Q[f]

Step4: If ( f== r) reset pointer f and r as f = r = -1

Step5: Stop
Remove_back
• remove_front() is a operation used to pop an element on front
of the Deque.

                     1   2       3   4   5         7    POP




                    FRONT                        REAR




                     1       2   3   4       5
Alogrithm Remove_back

step1. Start
step2. Check the queue is empty or not as if (f == r) if yes queue
                                                       is empty
step3. If false delete element at position r as element = Q[r]
step4. Update pointer r as r = r-1
step5. If (f == r ) reset pointer f and r as f = r= -1
step6. Stop
Empty

 It is used to test weather the Deque is empty or not.
APPLICATIONS OF DEQUE
Palindrome-checker
APPLICATIONS OF DEQUE
A-Steal job scheduling algorithm

 The A-Steal algorithm implements task scheduling for several
  processors(multiprocessor scheduling).

 The processor gets the first element from the deque.

 When one of the processor completes execution of its own
  threads it can steal a thread from another processor.

 It gets the last element from the deque of another processor
  and executes it.
OTHER APPLICATIONS OF DEQUE
 Undo-Redo operations in Software applications.
Thank You

Contenu connexe

Tendances

Queue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListQueue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked List
PTCL
 

Tendances (20)

linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Queue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked ListQueue Implementation Using Array & Linked List
Queue Implementation Using Array & Linked List
 
Unit I - Evaluation of expression
Unit I - Evaluation of expressionUnit I - Evaluation of expression
Unit I - Evaluation of expression
 
Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
 
Sparse matrix and its representation data structure
Sparse matrix and its representation data structureSparse matrix and its representation data structure
Sparse matrix and its representation data structure
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
Heaps
HeapsHeaps
Heaps
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursion
 
Heap sort
Heap sortHeap sort
Heap sort
 
Linked lists
Linked listsLinked lists
Linked lists
 
Stack
StackStack
Stack
 
Stack a Data Structure
Stack a Data StructureStack a Data Structure
Stack a Data Structure
 
Quick sort-Data Structure
Quick sort-Data StructureQuick sort-Data Structure
Quick sort-Data Structure
 
Bubble sort
Bubble sortBubble sort
Bubble sort
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
 
Binary search
Binary searchBinary search
Binary search
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
 

En vedette

Applications of queues ii
Applications of queues   iiApplications of queues   ii
Applications of queues ii
Tech_MX
 
Algorithm: priority queue
Algorithm: priority queueAlgorithm: priority queue
Algorithm: priority queue
Tareq Hasan
 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
Senthil Kumar
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
Tech_MX
 
Linked List Implementation of Deque in C
Linked List Implementation of Deque in CLinked List Implementation of Deque in C
Linked List Implementation of Deque in C
Kasun Ranga Wijeweera
 

En vedette (20)

Applications of queues ii
Applications of queues   iiApplications of queues   ii
Applications of queues ii
 
Algorithm: priority queue
Algorithm: priority queueAlgorithm: priority queue
Algorithm: priority queue
 
Priority queues
Priority queuesPriority queues
Priority queues
 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Priority queue
Priority queuePriority queue
Priority queue
 
Queue as data_structure
Queue as data_structureQueue as data_structure
Queue as data_structure
 
Ppt presentation of queues
Ppt presentation of queuesPpt presentation of queues
Ppt presentation of queues
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 
Queue Data Structure (w/ php egs)
Queue Data Structure (w/ php egs)Queue Data Structure (w/ php egs)
Queue Data Structure (w/ php egs)
 
Applications of stack
Applications of stackApplications of stack
Applications of stack
 
Notes DATA STRUCTURE - queue
Notes DATA STRUCTURE - queueNotes DATA STRUCTURE - queue
Notes DATA STRUCTURE - queue
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
23 priority queue
23 priority queue23 priority queue
23 priority queue
 
Queue
QueueQueue
Queue
 
Stack Applications
Stack ApplicationsStack Applications
Stack Applications
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Linked List Implementation of Deque in C
Linked List Implementation of Deque in CLinked List Implementation of Deque in C
Linked List Implementation of Deque in C
 
Stacks, Queues, Deques
Stacks, Queues, DequesStacks, Queues, Deques
Stacks, Queues, Deques
 
computer notes - Priority queue
computer notes -  Priority queuecomputer notes -  Priority queue
computer notes - Priority queue
 

Similaire à Deque and its applications

Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applications
Tech_MX
 
cp264_lecture18_queue.ppt
cp264_lecture18_queue.pptcp264_lecture18_queue.ppt
cp264_lecture18_queue.ppt
ssuserff72e4
 

Similaire à Deque and its applications (20)

Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applications
 
Stack.pptx
Stack.pptxStack.pptx
Stack.pptx
 
Queue
QueueQueue
Queue
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Queue
QueueQueue
Queue
 
Queue
QueueQueue
Queue
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Team 6
Team 6Team 6
Team 6
 
Lecture 2d queues
Lecture 2d queuesLecture 2d queues
Lecture 2d queues
 
cp264_lecture18_queue.ppt
cp264_lecture18_queue.pptcp264_lecture18_queue.ppt
cp264_lecture18_queue.ppt
 
Queue
QueueQueue
Queue
 
Queue
QueueQueue
Queue
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptx
 
Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)
 
Lect 17-18 Zaheer Abbas
Lect 17-18 Zaheer AbbasLect 17-18 Zaheer Abbas
Lect 17-18 Zaheer Abbas
 
Queue data structures and operation on data structures
Queue data structures and operation on data structuresQueue data structures and operation on data structures
Queue data structures and operation on data structures
 
Stack in Data Structure
Stack in Data StructureStack in Data Structure
Stack in Data Structure
 
Queue
QueueQueue
Queue
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Deque and its applications

  • 1. PRESENTED BY Chandramohan.R Manoranjani.K Racchana.K Rosalin Mary.S Saddam Hussain .J
  • 2. Double-Ended Queue  A Deque or deck is a double-ended queue.  Allows elements to be added or removed on either the ends.
  • 3. TYPES OF DEQUE  Input restricted Deque  Elements can be inserted only at one end.  Elements can be removed from both the ends.  Output restricted Deque  Elements can be removed only at one end.  Elements can be inserted from both the ends.
  • 4. Deque as Stack and Queue As STACK  When insertion and deletion is made at the same side. As Queue  When items are inserted at one end and removed at the other end.
  • 5. OPERATIONS IN DEQUE  Insert element at back  Insert element at front  Remove element at front  Remove element at back
  • 6. Insert_front  insert_front() is a operation used to push an element into the front of the Deque. PUSH 0 1 2 3 4 5 7 FRONT REAR 0 1 2 3 4 5 7
  • 7. Algorithm Insert_front step1. Start step2. Check the queue is full or not as if (r == max-1) &&(f==0) step3. If false update the pointer f as f= f-1 step4. Insert the element at pointer f as Q[f] = element step5. Stop
  • 8. Insert_back  insert_back() is a operation used to push an element at the back of a Deque. 1 2 3 4 5 7 PUSH 9 FRONT REAR 1 2 3 4 5 7
  • 9. Alogrithm insert_back Step1: Start Step2: Check the queue is full or not as if (r == max-1) &&(f==0) if yes queue is full Step3: If false update the pointer r as r= r+1 Step4: Insert the element at pointer r as Q[r] = element Step5: Stop
  • 10. Remove_front  remove_front() is a operation used to pop an element on front of the Deque. POP 1 2 3 4 5 7 FRONT REAR 2 3 4 5 7
  • 11. Alogrithm Remove_front Step1: Start Step2: Check the queue is empty or not as if (f == r) if yes queue is empty. Step3: If false update pointer f as f = f+1 and delete element at position f as element = Q[f] Step4: If ( f== r) reset pointer f and r as f = r = -1 Step5: Stop
  • 12. Remove_back • remove_front() is a operation used to pop an element on front of the Deque. 1 2 3 4 5 7 POP FRONT REAR 1 2 3 4 5
  • 13. Alogrithm Remove_back step1. Start step2. Check the queue is empty or not as if (f == r) if yes queue is empty step3. If false delete element at position r as element = Q[r] step4. Update pointer r as r = r-1 step5. If (f == r ) reset pointer f and r as f = r= -1 step6. Stop
  • 14. Empty  It is used to test weather the Deque is empty or not.
  • 16. APPLICATIONS OF DEQUE A-Steal job scheduling algorithm  The A-Steal algorithm implements task scheduling for several processors(multiprocessor scheduling).  The processor gets the first element from the deque.  When one of the processor completes execution of its own threads it can steal a thread from another processor.  It gets the last element from the deque of another processor and executes it.
  • 17. OTHER APPLICATIONS OF DEQUE  Undo-Redo operations in Software applications.