SlideShare a Scribd company logo
1 of 18
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

More Related Content

What's hot (20)

Project of data structure
Project of data structureProject of data structure
Project of data structure
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - Notes
 
Queue
QueueQueue
Queue
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
 
Data Structure and Algorithms Heaps and Trees
Data Structure and Algorithms Heaps and TreesData Structure and Algorithms Heaps and Trees
Data Structure and Algorithms Heaps and Trees
 
Stack and its applications
Stack and its applicationsStack and its applications
Stack and its applications
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
 
DATA STRUCTURE - STACK
DATA STRUCTURE - STACKDATA STRUCTURE - STACK
DATA STRUCTURE - STACK
 
Insertion sort
Insertion sort Insertion sort
Insertion sort
 
Stacks overview with its applications
Stacks overview with its applicationsStacks overview with its applications
Stacks overview with its applications
 
Stack
StackStack
Stack
 
Data structure by Digvijay
Data structure by DigvijayData structure by Digvijay
Data structure by Digvijay
 
deque and it applications
deque and it applicationsdeque and it applications
deque and it applications
 
Merge sort
Merge sortMerge sort
Merge sort
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
 
Array linear data_structure_2 (1)
Array linear data_structure_2 (1)Array linear data_structure_2 (1)
Array linear data_structure_2 (1)
 
Queue implementation
Queue implementationQueue implementation
Queue implementation
 
Linked list
Linked listLinked list
Linked list
 
Circular queue
Circular queueCircular queue
Circular queue
 

Viewers also liked

Object type casting
Object type castingObject type casting
Object type castingTech_MX
 
Db for rdbms
Db for rdbmsDb for rdbms
Db for rdbmsTech_MX
 
Inner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVAInner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVATech_MX
 
Ascii adjust & decimal adjust
Ascii adjust & decimal adjustAscii adjust & decimal adjust
Ascii adjust & decimal adjustTech_MX
 
Comparison of pentium processor with 80386 and 80486
Comparison of pentium processor with  80386 and 80486Comparison of pentium processor with  80386 and 80486
Comparison of pentium processor with 80386 and 80486Tech_MX
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbmsTech_MX
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controllerTech_MX
 
Mobile dbms
Mobile dbmsMobile dbms
Mobile dbmsTech_MX
 
How to Draw an Effective ER diagram
How to Draw an Effective ER diagramHow to Draw an Effective ER diagram
How to Draw an Effective ER diagramTech_MX
 
Virtual base class
Virtual base classVirtual base class
Virtual base classTech_MX
 

Viewers also liked (13)

Object type casting
Object type castingObject type casting
Object type casting
 
Db for rdbms
Db for rdbmsDb for rdbms
Db for rdbms
 
Ajax
AjaxAjax
Ajax
 
Ot ppt
Ot pptOt ppt
Ot ppt
 
Inner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVAInner Classes & Multi Threading in JAVA
Inner Classes & Multi Threading in JAVA
 
Ascii adjust & decimal adjust
Ascii adjust & decimal adjustAscii adjust & decimal adjust
Ascii adjust & decimal adjust
 
Parsing
ParsingParsing
Parsing
 
Comparison of pentium processor with 80386 and 80486
Comparison of pentium processor with  80386 and 80486Comparison of pentium processor with  80386 and 80486
Comparison of pentium processor with 80386 and 80486
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbms
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controller
 
Mobile dbms
Mobile dbmsMobile dbms
Mobile dbms
 
How to Draw an Effective ER diagram
How to Draw an Effective ER diagramHow to Draw an Effective ER diagram
How to Draw an Effective ER diagram
 
Virtual base class
Virtual base classVirtual base class
Virtual base class
 

Similar to Deque and its applications

Similar to Deque and its applications (20)

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
QueueQueue
Queue
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Lecture 2d queues
Lecture 2d queuesLecture 2d queues
Lecture 2d queues
 
Queue
QueueQueue
Queue
 
cp264_lecture18_queue.ppt
cp264_lecture18_queue.pptcp264_lecture18_queue.ppt
cp264_lecture18_queue.ppt
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptx
 
Queue
QueueQueue
Queue
 
Team 6
Team 6Team 6
Team 6
 
Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Stacks-and-Queues.pdf
Stacks-and-Queues.pdfStacks-and-Queues.pdf
Stacks-and-Queues.pdf
 
chapter10-queue-161018120329.pdf
chapter10-queue-161018120329.pdfchapter10-queue-161018120329.pdf
chapter10-queue-161018120329.pdf
 
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
 
Queue AS an ADT (Abstract Data Type)
Queue AS an ADT (Abstract Data Type)Queue AS an ADT (Abstract Data Type)
Queue AS an ADT (Abstract Data Type)
 

More from Tech_MX

Theory of estimation
Theory of estimationTheory of estimation
Theory of estimationTech_MX
 
Templates in C++
Templates in C++Templates in C++
Templates in C++Tech_MX
 
String & its application
String & its applicationString & its application
String & its applicationTech_MX
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2Tech_MX
 
Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
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
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applicationsTech_MX
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2Tech_MX
 
Set data structure
Set data structure Set data structure
Set data structure Tech_MX
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating SystemTech_MX
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Tech_MX
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pcTech_MX
 
More on Lex
More on LexMore on Lex
More on LexTech_MX
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)Tech_MX
 
Memory dbms
Memory dbmsMemory dbms
Memory dbmsTech_MX
 
Linear regression
Linear regressionLinear regression
Linear regressionTech_MX
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interruptTech_MX
 

More from Tech_MX (20)

Uid
UidUid
Uid
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimation
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
 
String & its application
String & its applicationString & its application
String & its application
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
Spss
SpssSpss
Spss
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2
 
Set data structure
Set data structure Set data structure
Set data structure
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pc
 
More on Lex
More on LexMore on Lex
More on Lex
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
 
Linkers
LinkersLinkers
Linkers
 
Linear regression
Linear regressionLinear regression
Linear regression
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
 

Recently uploaded

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 

Recently uploaded (20)

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 

Deque and its applications

  • 1.
  • 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.