SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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
 

Mais de 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
 

Mais de 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
 

Último

Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
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
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 

Último (20)

Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
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
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

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