SlideShare une entreprise Scribd logo
1  sur  33
QUEUE
Terminology : Front, Rear
Operations: Insertion(),Deletion(),Display()
Content
• What is Queue?
• Example of Queue.
• Queue working principle
• Queue Operations
• Representation of Queue
• Coding
• output
What is a Queue?
• Queue is a linear data structure in which the
insertion and deletion operations are
performed at two different ends.
• In a queue data structure, adding and
removing elements are performed at two
different positions.
• The insertion is performed at one end and
deletion is performed at another end.
• In a queue data structure, the insertion
operation is performed at a position which is
known as 'rear'
and
• the deletion operation is performed at a
position which is known as 'front'.
QUEUE
QUEUE
Principle
• In queue data structure, the insertion and
deletion operations are performed based on
FIFO (First In First Out) principle.
Operations on a Queue
• enQueue(value) - (To insert an element into
the queue)
• deQueue() - (To delete an element from the
queue)
• display() - (To display the elements of the
queue)
Queue data structure can be
implemented in two ways.
1. Using Array
2. Using Linked List
Queue data structure can be
implemented in two ways.
1. Using Array
Queue data structure can be
implemented in two ways.
2.Using Linked List
Queue Datastructure Using Array
• A queue data structure can be implemented
using one dimensional array.
• The queue implemented using array stores
only fixed number of data values.
Queue Datastructure Using Array
• Just define a one dimensional array of specific size and
insert or delete the values into that array by using FIFO
(First In First Out) principle with the help of
variables 'front' and 'rear'.
• Initially both 'front' and 'rear' are set to -1. Whenever, we
want to insert a new value into the queue, increment 'rear'
value by one and then insert at that position.
• Whenever we want to delete a value from the queue, then
delete the element which is at 'front' position and
increment 'front' value by one.
enQueue Operation
enQueue(value) - Inserting value into
the queue
• enQueue() is a function used to insert a new
element into the queue.
• In a queue, the new element is always
inserted at rear position.
• The enQueue() function takes one integer
value as a parameter and inserts that value
into the queue.
enQueue(value) - Inserting value into
the queue
Step 1 - Check whether queue is FULL.
(rear == SIZE-1)
Step 2 - If it is FULL, then display "Queue is
FULL!!! Insertion is not possible!!!" and
terminate the function.
• Step 3 - If it is NOT FULL, then
increment rear value by one (rear++) and
set queue[rear] = value.
enQueue(value) - Inserting value into
the queue
0 1 2 3 4
Front=-1
10 20 40
30 50
EnQueue(10) EnQueue(20) EnQueue(30) EnQueue(40) EnQueue(50)
Front
Rear Rear Rear Rear Rear
Queue
Rear=-1
DeQueue Operation
deQueue() - (To delete an element
from the queue)
• In a queue data structure, deQueue() is a
function used to delete an element from the
queue.
• In a queue, the element is always deleted
from front position.
• The deQueue() function does not take any
value as parameter.
deQueue() - (To delete an element
from the queue)
Step 1 - Check whether queue is EMPTY.
(front ==-1 && rear==-1)
Step 2 - If it is EMPTY, then display
"Queue is EMPTY!!! Deletion is not
possible!!!" and terminate the function.
Step 3 - If it is NOT EMPTY,
• Then display queue[front] as deleted element.
• Then check whether both front and rear are
equal (front == rear), if it TRUE, then set
both front and rear to '-1' (front = rear = -1).
• Then increment the front value by one
(front ++).
deQueue() - (To delete an element
from the queue)
0 1 2 3 4
10 20 40
30 50
deQueue(10) deQueue(20) deQueue(30) deQueue(40) deQueue(50)
Front Rear
Queue
Front Front Front
Front
Front=Rear=-1
if(front ==-1 && rear==-1)
Queue is Empty, deletion not possible.
Display Operation
display() - (To display the elements of
the queue)
Step 1 - Check whether queue is EMPTY.
(front ==-1 && rear==-1)
Step 2 - If it is EMPTY, then display
"Queue is EMPTY!!!" and terminate the
function.
display() - (To display the elements of
the queue)
Step 3 - If it is NOT EMPTY, then define an
integer variable 'i' and set 'i = front'.
Step 4 - Display 'queue[i]' value and increment
'i' value by one (i++). Repeat the same until 'i'
value reaches to rear (i <= rear)
Coding for Queue
OUTPUT
Thank You

Contenu connexe

Similaire à QUEUE.pptx (20)

queue.pptx
queue.pptxqueue.pptx
queue.pptx
 
Queues.ppt
Queues.pptQueues.ppt
Queues.ppt
 
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)
 
LEC4-DS ALGO.pdf
LEC4-DS  ALGO.pdfLEC4-DS  ALGO.pdf
LEC4-DS ALGO.pdf
 
@Chapter 4 DSA Part II.pptx
@Chapter 4 DSA Part II.pptx@Chapter 4 DSA Part II.pptx
@Chapter 4 DSA Part II.pptx
 
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
 
Unit 4 queue
Unit   4 queueUnit   4 queue
Unit 4 queue
 
2.1 Queue.pptx
2.1 Queue.pptx2.1 Queue.pptx
2.1 Queue.pptx
 
4. Queues in Data Structure
4. Queues in Data Structure4. Queues in Data Structure
4. Queues in Data Structure
 
Stack and Queue.pptx university exam preparation
Stack and Queue.pptx university exam preparationStack and Queue.pptx university exam preparation
Stack and Queue.pptx university exam preparation
 
Queue ppt
Queue pptQueue ppt
Queue ppt
 
Queue - Operations and Implementations
Queue - Operations and ImplementationsQueue - Operations and Implementations
Queue - Operations and Implementations
 
Queue
QueueQueue
Queue
 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
 
Queue and its operations
Queue and its operationsQueue and its operations
Queue and its operations
 
queueppt-191018053228 (1).pptx
queueppt-191018053228 (1).pptxqueueppt-191018053228 (1).pptx
queueppt-191018053228 (1).pptx
 
Unit ii linear data structures
Unit ii linear data structures Unit ii linear data structures
Unit ii linear data structures
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - Notes
 
Queues in C++
Queues in C++Queues in C++
Queues in C++
 
2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS
 

Plus de MattFlordeliza1

web host used tsu lecture reliable for other .pptx
web host used tsu lecture reliable for other .pptxweb host used tsu lecture reliable for other .pptx
web host used tsu lecture reliable for other .pptxMattFlordeliza1
 
bootstrap 4 used for discussion in chcci.pptx
bootstrap 4 used for discussion in chcci.pptxbootstrap 4 used for discussion in chcci.pptx
bootstrap 4 used for discussion in chcci.pptxMattFlordeliza1
 
JDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptxJDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptxMattFlordeliza1
 
ACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptxACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptxMattFlordeliza1
 
PLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptxPLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptxMattFlordeliza1
 
PLF-Lesson-5 programming in TSU lec.pptx
PLF-Lesson-5 programming in TSU lec.pptxPLF-Lesson-5 programming in TSU lec.pptx
PLF-Lesson-5 programming in TSU lec.pptxMattFlordeliza1
 
Psuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxPsuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxMattFlordeliza1
 

Plus de MattFlordeliza1 (8)

web host used tsu lecture reliable for other .pptx
web host used tsu lecture reliable for other .pptxweb host used tsu lecture reliable for other .pptx
web host used tsu lecture reliable for other .pptx
 
bootstrap 4 used for discussion in chcci.pptx
bootstrap 4 used for discussion in chcci.pptxbootstrap 4 used for discussion in chcci.pptx
bootstrap 4 used for discussion in chcci.pptx
 
JDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptxJDBC OVERVIEW uses from the subject of EDP.pptx
JDBC OVERVIEW uses from the subject of EDP.pptx
 
ACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptxACtionlistener in java use in discussion.pptx
ACtionlistener in java use in discussion.pptx
 
PLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptxPLF-Lesson tsu lecture time 2 units-2.pptx
PLF-Lesson tsu lecture time 2 units-2.pptx
 
PLF-Lesson-5 programming in TSU lec.pptx
PLF-Lesson-5 programming in TSU lec.pptxPLF-Lesson-5 programming in TSU lec.pptx
PLF-Lesson-5 programming in TSU lec.pptx
 
Psuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptxPsuedocode1, algorithm1, Flowchart1.pptx
Psuedocode1, algorithm1, Flowchart1.pptx
 
www module 1.pptx
www module 1.pptxwww module 1.pptx
www module 1.pptx
 

Dernier

Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Paige Cruz
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfalexjohnson7307
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxFIDO Alliance
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfAnubhavMangla3
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewDianaGray10
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...SOFTTECHHUB
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfdanishmna97
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data SciencePaolo Missier
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...caitlingebhard1
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTopCSSGallery
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 

Dernier (20)

Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 

QUEUE.pptx

  • 1. QUEUE Terminology : Front, Rear Operations: Insertion(),Deletion(),Display()
  • 2.
  • 3. Content • What is Queue? • Example of Queue. • Queue working principle • Queue Operations • Representation of Queue • Coding • output
  • 4. What is a Queue? • Queue is a linear data structure in which the insertion and deletion operations are performed at two different ends. • In a queue data structure, adding and removing elements are performed at two different positions. • The insertion is performed at one end and deletion is performed at another end.
  • 5. • In a queue data structure, the insertion operation is performed at a position which is known as 'rear' and • the deletion operation is performed at a position which is known as 'front'.
  • 8. Principle • In queue data structure, the insertion and deletion operations are performed based on FIFO (First In First Out) principle.
  • 9. Operations on a Queue • enQueue(value) - (To insert an element into the queue) • deQueue() - (To delete an element from the queue) • display() - (To display the elements of the queue)
  • 10. Queue data structure can be implemented in two ways. 1. Using Array 2. Using Linked List
  • 11. Queue data structure can be implemented in two ways. 1. Using Array
  • 12. Queue data structure can be implemented in two ways. 2.Using Linked List
  • 13. Queue Datastructure Using Array • A queue data structure can be implemented using one dimensional array. • The queue implemented using array stores only fixed number of data values.
  • 14. Queue Datastructure Using Array • Just define a one dimensional array of specific size and insert or delete the values into that array by using FIFO (First In First Out) principle with the help of variables 'front' and 'rear'. • Initially both 'front' and 'rear' are set to -1. Whenever, we want to insert a new value into the queue, increment 'rear' value by one and then insert at that position. • Whenever we want to delete a value from the queue, then delete the element which is at 'front' position and increment 'front' value by one.
  • 16. enQueue(value) - Inserting value into the queue • enQueue() is a function used to insert a new element into the queue. • In a queue, the new element is always inserted at rear position. • The enQueue() function takes one integer value as a parameter and inserts that value into the queue.
  • 17. enQueue(value) - Inserting value into the queue Step 1 - Check whether queue is FULL. (rear == SIZE-1) Step 2 - If it is FULL, then display "Queue is FULL!!! Insertion is not possible!!!" and terminate the function.
  • 18. • Step 3 - If it is NOT FULL, then increment rear value by one (rear++) and set queue[rear] = value.
  • 19. enQueue(value) - Inserting value into the queue 0 1 2 3 4 Front=-1 10 20 40 30 50 EnQueue(10) EnQueue(20) EnQueue(30) EnQueue(40) EnQueue(50) Front Rear Rear Rear Rear Rear Queue Rear=-1
  • 21. deQueue() - (To delete an element from the queue) • In a queue data structure, deQueue() is a function used to delete an element from the queue. • In a queue, the element is always deleted from front position. • The deQueue() function does not take any value as parameter.
  • 22. deQueue() - (To delete an element from the queue) Step 1 - Check whether queue is EMPTY. (front ==-1 && rear==-1) Step 2 - If it is EMPTY, then display "Queue is EMPTY!!! Deletion is not possible!!!" and terminate the function.
  • 23. Step 3 - If it is NOT EMPTY, • Then display queue[front] as deleted element. • Then check whether both front and rear are equal (front == rear), if it TRUE, then set both front and rear to '-1' (front = rear = -1). • Then increment the front value by one (front ++).
  • 24. deQueue() - (To delete an element from the queue) 0 1 2 3 4 10 20 40 30 50 deQueue(10) deQueue(20) deQueue(30) deQueue(40) deQueue(50) Front Rear Queue Front Front Front Front Front=Rear=-1 if(front ==-1 && rear==-1) Queue is Empty, deletion not possible.
  • 26. display() - (To display the elements of the queue) Step 1 - Check whether queue is EMPTY. (front ==-1 && rear==-1) Step 2 - If it is EMPTY, then display "Queue is EMPTY!!!" and terminate the function.
  • 27. display() - (To display the elements of the queue) Step 3 - If it is NOT EMPTY, then define an integer variable 'i' and set 'i = front'. Step 4 - Display 'queue[i]' value and increment 'i' value by one (i++). Repeat the same until 'i' value reaches to rear (i <= rear)
  • 28.
  • 30.
  • 31.