SlideShare a Scribd company logo
1 of 13
RECAP
 Data structure is a particular way of storing
and organizing data in a computer so that it
can be used efficiently.
 Different kinds of data structures are suited
to different kinds of applications, and some
are highly specialized to specific tasks.
 Linear (Array, queue, Linked list and stack)
 Non Linear ( tree and graph)
INTRODUCTION TO QUEUE
In ordinary English, a queue is
defined as a waiting line, like a line
of people waiting to purchase
tickets, where the first person in
line is the first person served.
REAL LIFE EXAMPLES OF QUEUE ARE:
1. A queue of people at ticket-window: The person who
comes first gets the ticket first. The person who is
coming last is getting the tickets in last. Therefore, it
follows first-in-first-out (FIFO) strategy of queue.
2. Luggage checking machine: Luggage checking
machine checks the luggage first that comes first.
Therefore, it follows FIFO principle of queue.
3. Patients waiting outside the doctor's clinic: The
patient who comes first visits the doctor first, and the
patient who comes last visits the doctor last.
Therefore, it follows the first-in-first-out (FIFO) strategy
of queue.
IN COMPUTER APLICATION
 For computer applications, we similarly
define a queue to be a list in which all
additions to the list are made at one
end, and all deletions from the list are
made at the other end.
 Queues are also called first-in, first-out
lists , or FIFO for short.
As in all parts of life, it is often necessary
to wait one’s turn before having access
to something.
Within a computer system there may be
queues of tasks waiting for the
printer, for access to disk storage etc…
IN COMPUTER APLICATION
COMPUTER APPLICATION EXAMPLES
 Imagine you have a web-site which serves files to
thousands of users. You cannot service all requests, you
can only handle say 100 at once. A fair policy would be
first-come-first serve: serve 100 at a time in order of
arrival. A Queue would definitely be the most appropriate
data structure.
 Similarly in a multitasking operating system, the CPU
cannot run all jobs at once, so jobs must be batched up
and then scheduled according to some policy. Again, a
queue might be a suitable option in this case.
 Say you have a number of documents to be printed at
once. Your OS puts all of these docs in a queue and
sends them to the printer. The printer takes and prints
each document in the order the docs are put in the
queue, ie, First In, First Out.
QUEUE OPERATIONS.
Indeed, we need to perform two operations with
queues:
append (or enqueue) - put an entry to the
queue, and
serve (also called delete or dequeue) -
remove an entry from the queue.
The entry in a queue ready to be served, that is, the
first entry that will be removed from the queue, is
called the front of the queue(or, sometimes, the
head of the queue).
Similarly, the last entry in the queue, that is, the one
most recently added, is called the rear (or the tail ) of
the queue.
STACK — ELEMENTS ARE PULLED IN LAST-IN
FIRST-OUT-ORDER (E.G. A STACK OF PAPERS)
QUEUE — ELEMENTS ARE PULLED IN FIRST-IN
FIRST-OUT-ORDER (E.G. A LINE IN A CAFETERIA)
A Graphic Model of a Queue
HOW HEAD AND TAIL CHANGE
Queue operation
RECAP
 It is a list in which all additions to the list are
made at one end, and all deletions from the
list are made at the other end.
 Say you have a number of documents to be
printed at once. Your OS puts all of these
docs in a queue and sends them to the
printer. The printer takes and prints each
document in the order the docs are put in the
queue, ie, First In, First Out.
TO PREPARE FOR NEXT SESSION
 Stack
 Operations on a stack
 Differences between queues and stack

More Related Content

What's hot

Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure Janki Shah
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy TutorialAfzal Badshah
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applicationssomendra kumar
 
Presentation on queue
Presentation on queuePresentation on queue
Presentation on queueRojan Pariyar
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Anand Ingle
 
Unit I - Evaluation of expression
Unit I - Evaluation of expressionUnit I - Evaluation of expression
Unit I - Evaluation of expressionDrkhanchanaR
 
Queue as data_structure
Queue as data_structureQueue as data_structure
Queue as data_structureeShikshak
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data StructureMeghaj Mallick
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structuresDurgaDeviCbit
 
Queue implementation
Queue implementationQueue implementation
Queue implementationRajendran
 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queueSenthil Kumar
 

What's hot (20)

Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutorial
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Queue
QueueQueue
Queue
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 
Presentation on queue
Presentation on queuePresentation on queue
Presentation on queue
 
Insertion Sorting
Insertion SortingInsertion Sorting
Insertion Sorting
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
 
Linked list
Linked listLinked list
Linked list
 
Stack
StackStack
Stack
 
Unit I - Evaluation of expression
Unit I - Evaluation of expressionUnit I - Evaluation of expression
Unit I - Evaluation of expression
 
Data structure by Digvijay
Data structure by DigvijayData structure by Digvijay
Data structure by Digvijay
 
Queue as data_structure
Queue as data_structureQueue as data_structure
Queue as data_structure
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
linked lists in data structures
linked lists in data structureslinked lists in data structures
linked lists in data structures
 
Data structures
Data structuresData structures
Data structures
 
Queue implementation
Queue implementationQueue implementation
Queue implementation
 
Stacks
StacksStacks
Stacks
 
stack & queue
stack & queuestack & queue
stack & queue
 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
 

Similar to Ppt presentation of queues

Lesson 4 - Queue ADT.pdf
Lesson 4 - Queue ADT.pdfLesson 4 - Queue ADT.pdf
Lesson 4 - Queue ADT.pdfLeandroJrErcia
 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturergomathi chlm
 
Write a program in C or C++ which simulates CPU scheduling in an opera.pdf
Write a program in C or C++ which simulates CPU scheduling in an opera.pdfWrite a program in C or C++ which simulates CPU scheduling in an opera.pdf
Write a program in C or C++ which simulates CPU scheduling in an opera.pdfsravi07
 
Mastering Python lesson 5a_lists_list_operations
Mastering Python lesson 5a_lists_list_operationsMastering Python lesson 5a_lists_list_operations
Mastering Python lesson 5a_lists_list_operationsRuth Marvin
 
Bedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdfBedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdfAyushBaiswar1
 
Buffer overflow attacks
Buffer overflow attacksBuffer overflow attacks
Buffer overflow attacksSandun Perera
 
Analysis Mechanical system using Artificial intelligence
Analysis Mechanical system using Artificial intelligenceAnalysis Mechanical system using Artificial intelligence
Analysis Mechanical system using Artificial intelligenceanishahmadgrd222
 
15. Computer Systems Basic Software 1
15. Computer Systems   Basic Software 115. Computer Systems   Basic Software 1
15. Computer Systems Basic Software 1New Era University
 

Similar to Ppt presentation of queues (20)

stack.ppt
stack.pptstack.ppt
stack.ppt
 
Data Structures - Lecture 6 [queues]
Data Structures - Lecture 6 [queues]Data Structures - Lecture 6 [queues]
Data Structures - Lecture 6 [queues]
 
Lesson 4 - Queue ADT.pdf
Lesson 4 - Queue ADT.pdfLesson 4 - Queue ADT.pdf
Lesson 4 - Queue ADT.pdf
 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturer
 
Data Structures
Data StructuresData Structures
Data Structures
 
Write a program in C or C++ which simulates CPU scheduling in an opera.pdf
Write a program in C or C++ which simulates CPU scheduling in an opera.pdfWrite a program in C or C++ which simulates CPU scheduling in an opera.pdf
Write a program in C or C++ which simulates CPU scheduling in an opera.pdf
 
Intro ds
Intro dsIntro ds
Intro ds
 
TSAT Presentation1.pptx
TSAT Presentation1.pptxTSAT Presentation1.pptx
TSAT Presentation1.pptx
 
Mastering Python lesson 5a_lists_list_operations
Mastering Python lesson 5a_lists_list_operationsMastering Python lesson 5a_lists_list_operations
Mastering Python lesson 5a_lists_list_operations
 
Ch-8.pdf
Ch-8.pdfCh-8.pdf
Ch-8.pdf
 
Bedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdfBedtime Stories on Operating Systems.pdf
Bedtime Stories on Operating Systems.pdf
 
Bt0065
Bt0065Bt0065
Bt0065
 
B T0065
B T0065B T0065
B T0065
 
Bt0070
Bt0070Bt0070
Bt0070
 
Stack & Queue
Stack & QueueStack & Queue
Stack & Queue
 
Buffer overflow attacks
Buffer overflow attacksBuffer overflow attacks
Buffer overflow attacks
 
Analysis Mechanical system using Artificial intelligence
Analysis Mechanical system using Artificial intelligenceAnalysis Mechanical system using Artificial intelligence
Analysis Mechanical system using Artificial intelligence
 
15. Computer Systems Basic Software 1
15. Computer Systems   Basic Software 115. Computer Systems   Basic Software 1
15. Computer Systems Basic Software 1
 
Disk Scheduling In Operating System.pptx
Disk Scheduling In Operating System.pptxDisk Scheduling In Operating System.pptx
Disk Scheduling In Operating System.pptx
 
Tpl dataflow
Tpl dataflowTpl dataflow
Tpl dataflow
 

More from Buxoo Abdullah

CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1Buxoo Abdullah
 
2.1.1 PROBLEM SOLVING & DESIGN
2.1.1 PROBLEM SOLVING & DESIGN2.1.1 PROBLEM SOLVING & DESIGN
2.1.1 PROBLEM SOLVING & DESIGNBuxoo Abdullah
 
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
COMPUTER SCIENCE PRE RELEASE  2210 FOR NOVEMBER 2018 P22COMPUTER SCIENCE PRE RELEASE  2210 FOR NOVEMBER 2018 P22
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22Buxoo Abdullah
 
Computer health & safety issues
Computer health & safety issuesComputer health & safety issues
Computer health & safety issuesBuxoo Abdullah
 
Program & language generation
Program & language generationProgram & language generation
Program & language generationBuxoo Abdullah
 
Formative & summative evaluation
Formative & summative evaluationFormative & summative evaluation
Formative & summative evaluationBuxoo Abdullah
 

More from Buxoo Abdullah (14)

1.1.2 HEXADECIMAL
1.1.2 HEXADECIMAL1.1.2 HEXADECIMAL
1.1.2 HEXADECIMAL
 
MONEY & BANKING
MONEY & BANKINGMONEY & BANKING
MONEY & BANKING
 
Retail trade
Retail tradeRetail trade
Retail trade
 
1.1.3 DATA STORAGE
1.1.3 DATA STORAGE1.1.3 DATA STORAGE
1.1.3 DATA STORAGE
 
CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1CODING WITH PYTHON PART 1
CODING WITH PYTHON PART 1
 
2.1.1 PROBLEM SOLVING & DESIGN
2.1.1 PROBLEM SOLVING & DESIGN2.1.1 PROBLEM SOLVING & DESIGN
2.1.1 PROBLEM SOLVING & DESIGN
 
1.1.1 BINARY SYSTEM
1.1.1 BINARY SYSTEM1.1.1 BINARY SYSTEM
1.1.1 BINARY SYSTEM
 
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
COMPUTER SCIENCE PRE RELEASE  2210 FOR NOVEMBER 2018 P22COMPUTER SCIENCE PRE RELEASE  2210 FOR NOVEMBER 2018 P22
COMPUTER SCIENCE PRE RELEASE 2210 FOR NOVEMBER 2018 P22
 
Computer health & safety issues
Computer health & safety issuesComputer health & safety issues
Computer health & safety issues
 
Program & language generation
Program & language generationProgram & language generation
Program & language generation
 
Data and information
Data and informationData and information
Data and information
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Input devices
Input devicesInput devices
Input devices
 
Formative & summative evaluation
Formative & summative evaluationFormative & summative evaluation
Formative & summative evaluation
 

Recently uploaded

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 

Recently uploaded (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 

Ppt presentation of queues

  • 1. RECAP  Data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.  Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks.  Linear (Array, queue, Linked list and stack)  Non Linear ( tree and graph)
  • 2. INTRODUCTION TO QUEUE In ordinary English, a queue is defined as a waiting line, like a line of people waiting to purchase tickets, where the first person in line is the first person served.
  • 3. REAL LIFE EXAMPLES OF QUEUE ARE: 1. A queue of people at ticket-window: The person who comes first gets the ticket first. The person who is coming last is getting the tickets in last. Therefore, it follows first-in-first-out (FIFO) strategy of queue. 2. Luggage checking machine: Luggage checking machine checks the luggage first that comes first. Therefore, it follows FIFO principle of queue. 3. Patients waiting outside the doctor's clinic: The patient who comes first visits the doctor first, and the patient who comes last visits the doctor last. Therefore, it follows the first-in-first-out (FIFO) strategy of queue.
  • 4. IN COMPUTER APLICATION  For computer applications, we similarly define a queue to be a list in which all additions to the list are made at one end, and all deletions from the list are made at the other end.  Queues are also called first-in, first-out lists , or FIFO for short.
  • 5. As in all parts of life, it is often necessary to wait one’s turn before having access to something. Within a computer system there may be queues of tasks waiting for the printer, for access to disk storage etc… IN COMPUTER APLICATION
  • 6. COMPUTER APPLICATION EXAMPLES  Imagine you have a web-site which serves files to thousands of users. You cannot service all requests, you can only handle say 100 at once. A fair policy would be first-come-first serve: serve 100 at a time in order of arrival. A Queue would definitely be the most appropriate data structure.  Similarly in a multitasking operating system, the CPU cannot run all jobs at once, so jobs must be batched up and then scheduled according to some policy. Again, a queue might be a suitable option in this case.  Say you have a number of documents to be printed at once. Your OS puts all of these docs in a queue and sends them to the printer. The printer takes and prints each document in the order the docs are put in the queue, ie, First In, First Out.
  • 7. QUEUE OPERATIONS. Indeed, we need to perform two operations with queues: append (or enqueue) - put an entry to the queue, and serve (also called delete or dequeue) - remove an entry from the queue. The entry in a queue ready to be served, that is, the first entry that will be removed from the queue, is called the front of the queue(or, sometimes, the head of the queue). Similarly, the last entry in the queue, that is, the one most recently added, is called the rear (or the tail ) of the queue.
  • 8. STACK — ELEMENTS ARE PULLED IN LAST-IN FIRST-OUT-ORDER (E.G. A STACK OF PAPERS) QUEUE — ELEMENTS ARE PULLED IN FIRST-IN FIRST-OUT-ORDER (E.G. A LINE IN A CAFETERIA)
  • 9. A Graphic Model of a Queue
  • 10. HOW HEAD AND TAIL CHANGE
  • 12. RECAP  It is a list in which all additions to the list are made at one end, and all deletions from the list are made at the other end.  Say you have a number of documents to be printed at once. Your OS puts all of these docs in a queue and sends them to the printer. The printer takes and prints each document in the order the docs are put in the queue, ie, First In, First Out.
  • 13. TO PREPARE FOR NEXT SESSION  Stack  Operations on a stack  Differences between queues and stack