尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
DATA STRUCTURES
UNIT-2
SELVA KUMAR S
ASSISTANT PROFESSOR
B.M.S. COLLEGE OF ENGINEERING
QUEUE -ADT
• Queue: A list or a collection with the restrictions
that insertion can be performed at one end (the
rear or tail of the queue) and deletion can be
performed at other end (the front or head of the
queue).
• A queue is a FIFO(first in, first out) data structure
– Any waiting line is a queue:
– The check-out line at a grocery store
– The cars at a stop light
– Ticket counter
Conceptual view of a Queue
Uses of Queue in computing
• For any kind of problem involving FIFO Data.
• Printer Queue
• Keyboard Input buffer
• GUI Event Queue
• Web browser request Queue
Uses of Queues in computing
• In simulation studies, where the goal is to
reduce waiting times:
– Optimize the flow of traffic at a traffic light
– Determine the number of cashiers to have on duty
at a grocery store at different times of day
• Process Scheduling
• Printer Queues in Network
Queue Operations
• Enqueue(x) or push(x): add an element to the tail
of a queue.
• Dequeue() or pop(): remove an element from the
head of a queue.
• Front() or peek(): examine the element at the
head of the queue.
• QEmpty() or IsEmpty()
• QFull() or IsFull()
• It is not legal to access the elements in the
middle of the queue!
Implementation of Queues
• Array
• Linked List
Array Implementation
C Code
C code
Circular Queue
• Why we need a circular queue, when we
already have linear queue data structure.
Circular Queue
• Circular Queue is also a linear data structure, which follows
the principle of FIFO(First In First Out), but instead of ending
the queue at the last position, it again starts from the first
position after the last, hence making the queue behave like a
circular data structure.
Circular Queue
• In a circular queue, data is not actually removed from the queue. Only
the head pointer is incremented by one position when dequeue is
executed. As the queue data is only the data between head and tail, hence
the data left outside is not a part of the queue anymore, hence removed.
Circular Queue
• The head and the tail pointer will get reinitialised to 0 every
time they reach the end of the queue.
• Current Position = i
• Next Position = (i+1)% N
• Previous Position = (i+N-1)%N
Application of Circular Queue
• Below we have some common real-world
examples where circular queues are used:
• Computer controlled Traffic Signal
System uses circular queue.
• CPU scheduling and Memory management.
Implementation of Circular Queue
Implementation of Circular Queue
C Code – Circular Queue
Double ended Queue
• Deque or Double Ended Queue is a type of queue in which insertion
and removal of elements can be performed from either from the
front or rear. Thus, it does not follow FIFO rule (First In First Out).
• Types of Deque
• Input Restricted Deque
– In this deque, input is restricted at a single end but allows deletion at both
the ends.
• Output Restricted Deque
– In this deque, output is restricted at a single end but allows insertion at
both the ends.
Applications
Algorithm
C Code
Priority Queue
• Priority Queue is an extension of queue with
following properties.
– Every item has a priority associated with it.
– An element with high priority is dequeued before
an element with low priority.
– If two elements have the same priority, they are
served according to their order in the queue.
Priority Queue
• In a queue, the first-in-first-out rule is implemented whereas,
in a priority queue, the values are removed on the basis of
priority. The element with the highest priority is removed
first.
Types of Priority Queue
• Min Priority Queue: In min priority Queue
minimum number of value gets the highest
priority and lowest number of element gets
the highest priority.
• Max Priority Queue: Max priority Queue is
the opposite of min priority Queue in it
maximum number value gets the highest
priority and minimum number of value gets
the minimum priority.
Solution
C Code
C Code
C Code
Priority Queue (Circular Q concept)
UNIT-2.pptx
UNIT-2.pptx

More Related Content

Similar to UNIT-2.pptx

Fundamentals of Data Structure and Queues
Fundamentals of Data Structure and QueuesFundamentals of Data Structure and Queues
Fundamentals of Data Structure and Queues
Bogiri Nagaraju
 
QUEUE
QUEUEQUEUE
QUEUE
PTCL
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
mayankKatiyar17
 
Data Structures
Data StructuresData Structures
Data Structures
Dr.Umadevi V
 
Stack and Queue.pptx
Stack and Queue.pptxStack and Queue.pptx
Stack and Queue.pptx
Ddushb
 
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queuesFallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
SnehilKeshari
 
linked list in c++
linked list in c++linked list in c++
linked list in c++
YaminiLakshmi Meduri
 
Queue
QueueQueue
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptx
LECO9
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptx
SKUP1
 
Data Structures - Lecture 6 [queues]
Data Structures - Lecture 6 [queues]Data Structures - Lecture 6 [queues]
Data Structures - Lecture 6 [queues]
Muhammad Hammad Waseem
 
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)
Self-Employed
 
Ds
DsDs
QUEUE in data-structure (classification, working procedure, Applications)
QUEUE in data-structure (classification, working procedure, Applications)QUEUE in data-structure (classification, working procedure, Applications)
QUEUE in data-structure (classification, working procedure, Applications)
Mehedi Hasan
 
Implementation of queue using singly and doubly linked list.
Implementation of queue using singly and doubly linked list.Implementation of queue using singly and doubly linked list.
Implementation of queue using singly and doubly linked list.
central university of bihar
 
Unit 4 queue
Unit   4 queueUnit   4 queue
Unit 4 queue
Dabbal Singh Mahara
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
Lovely Professional University
 
II B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptxII B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptx
sabithabanu83
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
Meghaj Mallick
 
PLC
PLCPLC

Similar to UNIT-2.pptx (20)

Fundamentals of Data Structure and Queues
Fundamentals of Data Structure and QueuesFundamentals of Data Structure and Queues
Fundamentals of Data Structure and Queues
 
QUEUE
QUEUEQUEUE
QUEUE
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
Data Structures
Data StructuresData Structures
Data Structures
 
Stack and Queue.pptx
Stack and Queue.pptxStack and Queue.pptx
Stack and Queue.pptx
 
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queuesFallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
 
linked list in c++
linked list in c++linked list in c++
linked list in c++
 
Queue
QueueQueue
Queue
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptx
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptx
 
Data Structures - Lecture 6 [queues]
Data Structures - Lecture 6 [queues]Data Structures - Lecture 6 [queues]
Data Structures - Lecture 6 [queues]
 
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)
 
Ds
DsDs
Ds
 
QUEUE in data-structure (classification, working procedure, Applications)
QUEUE in data-structure (classification, working procedure, Applications)QUEUE in data-structure (classification, working procedure, Applications)
QUEUE in data-structure (classification, working procedure, Applications)
 
Implementation of queue using singly and doubly linked list.
Implementation of queue using singly and doubly linked list.Implementation of queue using singly and doubly linked list.
Implementation of queue using singly and doubly linked list.
 
Unit 4 queue
Unit   4 queueUnit   4 queue
Unit 4 queue
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
II B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptxII B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptx
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
PLC
PLCPLC
PLC
 

More from ChiragSuresh

wepik-mastering-the-art-of-entrepreneurship-20240313164953QR4t.pptx
wepik-mastering-the-art-of-entrepreneurship-20240313164953QR4t.pptxwepik-mastering-the-art-of-entrepreneurship-20240313164953QR4t.pptx
wepik-mastering-the-art-of-entrepreneurship-20240313164953QR4t.pptx
ChiragSuresh
 
PorterchitwetyujbzxcbbnmlkhggfdPorter.ppt
PorterchitwetyujbzxcbbnmlkhggfdPorter.pptPorterchitwetyujbzxcbbnmlkhggfdPorter.ppt
PorterchitwetyujbzxcbbnmlkhggfdPorter.ppt
ChiragSuresh
 
Unit-4- Process oveunit5and6forview.pptx
Unit-4- Process oveunit5and6forview.pptxUnit-4- Process oveunit5and6forview.pptx
Unit-4- Process oveunit5and6forview.pptx
ChiragSuresh
 
osama-quantum-computingoftge quantum.ppt
osama-quantum-computingoftge quantum.pptosama-quantum-computingoftge quantum.ppt
osama-quantum-computingoftge quantum.ppt
ChiragSuresh
 
Luo_SC_mc_butorqwertyuiomabsvsbsbsjC.ppt
Luo_SC_mc_butorqwertyuiomabsvsbsbsjC.pptLuo_SC_mc_butorqwertyuiomabsvsbsbsjC.ppt
Luo_SC_mc_butorqwertyuiomabsvsbsbsjC.ppt
ChiragSuresh
 
Bharti Airtel_ Connectivity Empowering Millions.pptx
Bharti Airtel_ Connectivity Empowering Millions.pptxBharti Airtel_ Connectivity Empowering Millions.pptx
Bharti Airtel_ Connectivity Empowering Millions.pptx
ChiragSuresh
 
509404501-Online-Shopping-System-Mini-Project-Ppt (1).pptx
509404501-Online-Shopping-System-Mini-Project-Ppt (1).pptx509404501-Online-Shopping-System-Mini-Project-Ppt (1).pptx
509404501-Online-Shopping-System-Mini-Project-Ppt (1).pptx
ChiragSuresh
 
Student repository System.pptx
Student repository System.pptxStudent repository System.pptx
Student repository System.pptx
ChiragSuresh
 
Unit1_Part2-Machine_Instructions_Programs_7_9_2018_3pm.ppt
Unit1_Part2-Machine_Instructions_Programs_7_9_2018_3pm.pptUnit1_Part2-Machine_Instructions_Programs_7_9_2018_3pm.ppt
Unit1_Part2-Machine_Instructions_Programs_7_9_2018_3pm.ppt
ChiragSuresh
 

More from ChiragSuresh (9)

wepik-mastering-the-art-of-entrepreneurship-20240313164953QR4t.pptx
wepik-mastering-the-art-of-entrepreneurship-20240313164953QR4t.pptxwepik-mastering-the-art-of-entrepreneurship-20240313164953QR4t.pptx
wepik-mastering-the-art-of-entrepreneurship-20240313164953QR4t.pptx
 
PorterchitwetyujbzxcbbnmlkhggfdPorter.ppt
PorterchitwetyujbzxcbbnmlkhggfdPorter.pptPorterchitwetyujbzxcbbnmlkhggfdPorter.ppt
PorterchitwetyujbzxcbbnmlkhggfdPorter.ppt
 
Unit-4- Process oveunit5and6forview.pptx
Unit-4- Process oveunit5and6forview.pptxUnit-4- Process oveunit5and6forview.pptx
Unit-4- Process oveunit5and6forview.pptx
 
osama-quantum-computingoftge quantum.ppt
osama-quantum-computingoftge quantum.pptosama-quantum-computingoftge quantum.ppt
osama-quantum-computingoftge quantum.ppt
 
Luo_SC_mc_butorqwertyuiomabsvsbsbsjC.ppt
Luo_SC_mc_butorqwertyuiomabsvsbsbsjC.pptLuo_SC_mc_butorqwertyuiomabsvsbsbsjC.ppt
Luo_SC_mc_butorqwertyuiomabsvsbsbsjC.ppt
 
Bharti Airtel_ Connectivity Empowering Millions.pptx
Bharti Airtel_ Connectivity Empowering Millions.pptxBharti Airtel_ Connectivity Empowering Millions.pptx
Bharti Airtel_ Connectivity Empowering Millions.pptx
 
509404501-Online-Shopping-System-Mini-Project-Ppt (1).pptx
509404501-Online-Shopping-System-Mini-Project-Ppt (1).pptx509404501-Online-Shopping-System-Mini-Project-Ppt (1).pptx
509404501-Online-Shopping-System-Mini-Project-Ppt (1).pptx
 
Student repository System.pptx
Student repository System.pptxStudent repository System.pptx
Student repository System.pptx
 
Unit1_Part2-Machine_Instructions_Programs_7_9_2018_3pm.ppt
Unit1_Part2-Machine_Instructions_Programs_7_9_2018_3pm.pptUnit1_Part2-Machine_Instructions_Programs_7_9_2018_3pm.ppt
Unit1_Part2-Machine_Instructions_Programs_7_9_2018_3pm.ppt
 

Recently uploaded

MODULE 5 BIOLOGY FOR ENGINEERS TRENDS IN BIO ENGINEERING.pptx
MODULE 5 BIOLOGY FOR ENGINEERS TRENDS IN BIO ENGINEERING.pptxMODULE 5 BIOLOGY FOR ENGINEERS TRENDS IN BIO ENGINEERING.pptx
MODULE 5 BIOLOGY FOR ENGINEERS TRENDS IN BIO ENGINEERING.pptx
NaveenNaveen726446
 
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdfSELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
Pallavi Sharma
 
Data Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdfData Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdf
Kamal Acharya
 
Call Girls Nagpur 8824825030 Escort In Nagpur service 24X7
Call Girls Nagpur 8824825030 Escort In Nagpur service 24X7Call Girls Nagpur 8824825030 Escort In Nagpur service 24X7
Call Girls Nagpur 8824825030 Escort In Nagpur service 24X7
sexytaniya455
 
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl LucknowCall Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
yogita singh$A17
 
Butterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdfButterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdf
Lubi Valves
 
Microsoft Azure AD architecture and features
Microsoft Azure AD architecture and featuresMicrosoft Azure AD architecture and features
Microsoft Azure AD architecture and features
ssuser381403
 
Call Girls In Tiruppur 👯‍♀️ 7339748667 🔥 Free Home Delivery Within 30 Minutes
Call Girls In Tiruppur 👯‍♀️ 7339748667 🔥 Free Home Delivery Within 30 MinutesCall Girls In Tiruppur 👯‍♀️ 7339748667 🔥 Free Home Delivery Within 30 Minutes
Call Girls In Tiruppur 👯‍♀️ 7339748667 🔥 Free Home Delivery Within 30 Minutes
kamka4105
 
Covid Management System Project Report.pdf
Covid Management System Project Report.pdfCovid Management System Project Report.pdf
Covid Management System Project Report.pdf
Kamal Acharya
 
My Airframe Metallic Design Capability Studies..pdf
My Airframe Metallic Design Capability Studies..pdfMy Airframe Metallic Design Capability Studies..pdf
My Airframe Metallic Design Capability Studies..pdf
Geoffrey Wardle. MSc. MSc. Snr.MAIAA
 
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
hotchicksescort
 
Cricket management system ptoject report.pdf
Cricket management system ptoject report.pdfCricket management system ptoject report.pdf
Cricket management system ptoject report.pdf
Kamal Acharya
 
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUESAN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
drshikhapandey2022
 
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
nainakaoornoida
 
Technological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdfTechnological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdf
tanujaharish2
 
paper relate Chozhavendhan et al. 2020.pdf
paper relate Chozhavendhan et al. 2020.pdfpaper relate Chozhavendhan et al. 2020.pdf
paper relate Chozhavendhan et al. 2020.pdf
ShurooqTaib
 
CSP_Study - Notes (Paul McNeill) 2017.pdf
CSP_Study - Notes (Paul McNeill) 2017.pdfCSP_Study - Notes (Paul McNeill) 2017.pdf
CSP_Study - Notes (Paul McNeill) 2017.pdf
Ismail Sultan
 
An In-Depth Exploration of Natural Language Processing: Evolution, Applicatio...
An In-Depth Exploration of Natural Language Processing: Evolution, Applicatio...An In-Depth Exploration of Natural Language Processing: Evolution, Applicatio...
An In-Depth Exploration of Natural Language Processing: Evolution, Applicatio...
DharmaBanothu
 
Literature review for prompt engineering of ChatGPT.pptx
Literature review for prompt engineering of ChatGPT.pptxLiterature review for prompt engineering of ChatGPT.pptx
Literature review for prompt engineering of ChatGPT.pptx
LokerXu2
 
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdfFUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
EMERSON EDUARDO RODRIGUES
 

Recently uploaded (20)

MODULE 5 BIOLOGY FOR ENGINEERS TRENDS IN BIO ENGINEERING.pptx
MODULE 5 BIOLOGY FOR ENGINEERS TRENDS IN BIO ENGINEERING.pptxMODULE 5 BIOLOGY FOR ENGINEERS TRENDS IN BIO ENGINEERING.pptx
MODULE 5 BIOLOGY FOR ENGINEERS TRENDS IN BIO ENGINEERING.pptx
 
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdfSELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
 
Data Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdfData Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdf
 
Call Girls Nagpur 8824825030 Escort In Nagpur service 24X7
Call Girls Nagpur 8824825030 Escort In Nagpur service 24X7Call Girls Nagpur 8824825030 Escort In Nagpur service 24X7
Call Girls Nagpur 8824825030 Escort In Nagpur service 24X7
 
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl LucknowCall Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
 
Butterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdfButterfly Valves Manufacturer (LBF Series).pdf
Butterfly Valves Manufacturer (LBF Series).pdf
 
Microsoft Azure AD architecture and features
Microsoft Azure AD architecture and featuresMicrosoft Azure AD architecture and features
Microsoft Azure AD architecture and features
 
Call Girls In Tiruppur 👯‍♀️ 7339748667 🔥 Free Home Delivery Within 30 Minutes
Call Girls In Tiruppur 👯‍♀️ 7339748667 🔥 Free Home Delivery Within 30 MinutesCall Girls In Tiruppur 👯‍♀️ 7339748667 🔥 Free Home Delivery Within 30 Minutes
Call Girls In Tiruppur 👯‍♀️ 7339748667 🔥 Free Home Delivery Within 30 Minutes
 
Covid Management System Project Report.pdf
Covid Management System Project Report.pdfCovid Management System Project Report.pdf
Covid Management System Project Report.pdf
 
My Airframe Metallic Design Capability Studies..pdf
My Airframe Metallic Design Capability Studies..pdfMy Airframe Metallic Design Capability Studies..pdf
My Airframe Metallic Design Capability Studies..pdf
 
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
❣Unsatisfied Bhabhi Call Girls Surat 💯Call Us 🔝 7014168258 🔝💃Independent Sura...
 
Cricket management system ptoject report.pdf
Cricket management system ptoject report.pdfCricket management system ptoject report.pdf
Cricket management system ptoject report.pdf
 
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUESAN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
 
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
 
Technological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdfTechnological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdf
 
paper relate Chozhavendhan et al. 2020.pdf
paper relate Chozhavendhan et al. 2020.pdfpaper relate Chozhavendhan et al. 2020.pdf
paper relate Chozhavendhan et al. 2020.pdf
 
CSP_Study - Notes (Paul McNeill) 2017.pdf
CSP_Study - Notes (Paul McNeill) 2017.pdfCSP_Study - Notes (Paul McNeill) 2017.pdf
CSP_Study - Notes (Paul McNeill) 2017.pdf
 
An In-Depth Exploration of Natural Language Processing: Evolution, Applicatio...
An In-Depth Exploration of Natural Language Processing: Evolution, Applicatio...An In-Depth Exploration of Natural Language Processing: Evolution, Applicatio...
An In-Depth Exploration of Natural Language Processing: Evolution, Applicatio...
 
Literature review for prompt engineering of ChatGPT.pptx
Literature review for prompt engineering of ChatGPT.pptxLiterature review for prompt engineering of ChatGPT.pptx
Literature review for prompt engineering of ChatGPT.pptx
 
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdfFUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
FUNDAMENTALS OF MECHANICAL ENGINEERING.pdf
 

UNIT-2.pptx

  • 1. DATA STRUCTURES UNIT-2 SELVA KUMAR S ASSISTANT PROFESSOR B.M.S. COLLEGE OF ENGINEERING
  • 2. QUEUE -ADT • Queue: A list or a collection with the restrictions that insertion can be performed at one end (the rear or tail of the queue) and deletion can be performed at other end (the front or head of the queue). • A queue is a FIFO(first in, first out) data structure – Any waiting line is a queue: – The check-out line at a grocery store – The cars at a stop light – Ticket counter
  • 4. Uses of Queue in computing • For any kind of problem involving FIFO Data. • Printer Queue • Keyboard Input buffer • GUI Event Queue • Web browser request Queue
  • 5. Uses of Queues in computing • In simulation studies, where the goal is to reduce waiting times: – Optimize the flow of traffic at a traffic light – Determine the number of cashiers to have on duty at a grocery store at different times of day • Process Scheduling • Printer Queues in Network
  • 6. Queue Operations • Enqueue(x) or push(x): add an element to the tail of a queue. • Dequeue() or pop(): remove an element from the head of a queue. • Front() or peek(): examine the element at the head of the queue. • QEmpty() or IsEmpty() • QFull() or IsFull() • It is not legal to access the elements in the middle of the queue!
  • 7. Implementation of Queues • Array • Linked List
  • 11. Circular Queue • Why we need a circular queue, when we already have linear queue data structure.
  • 12. Circular Queue • Circular Queue is also a linear data structure, which follows the principle of FIFO(First In First Out), but instead of ending the queue at the last position, it again starts from the first position after the last, hence making the queue behave like a circular data structure.
  • 13. Circular Queue • In a circular queue, data is not actually removed from the queue. Only the head pointer is incremented by one position when dequeue is executed. As the queue data is only the data between head and tail, hence the data left outside is not a part of the queue anymore, hence removed.
  • 14. Circular Queue • The head and the tail pointer will get reinitialised to 0 every time they reach the end of the queue. • Current Position = i • Next Position = (i+1)% N • Previous Position = (i+N-1)%N
  • 15. Application of Circular Queue • Below we have some common real-world examples where circular queues are used: • Computer controlled Traffic Signal System uses circular queue. • CPU scheduling and Memory management.
  • 18.
  • 19. C Code – Circular Queue
  • 20.
  • 21. Double ended Queue • Deque or Double Ended Queue is a type of queue in which insertion and removal of elements can be performed from either from the front or rear. Thus, it does not follow FIFO rule (First In First Out). • Types of Deque • Input Restricted Deque – In this deque, input is restricted at a single end but allows deletion at both the ends. • Output Restricted Deque – In this deque, output is restricted at a single end but allows insertion at both the ends.
  • 24.
  • 26.
  • 27.
  • 28. Priority Queue • Priority Queue is an extension of queue with following properties. – Every item has a priority associated with it. – An element with high priority is dequeued before an element with low priority. – If two elements have the same priority, they are served according to their order in the queue.
  • 29. Priority Queue • In a queue, the first-in-first-out rule is implemented whereas, in a priority queue, the values are removed on the basis of priority. The element with the highest priority is removed first.
  • 30. Types of Priority Queue • Min Priority Queue: In min priority Queue minimum number of value gets the highest priority and lowest number of element gets the highest priority. • Max Priority Queue: Max priority Queue is the opposite of min priority Queue in it maximum number value gets the highest priority and minimum number of value gets the minimum priority.
  • 32.
  • 33.

Editor's Notes

  1. In a Linear queue, once the queue is completely full, it's not possible to insert more elements. Even if we dequeue the queue to remove some of the elements, until the queue is reset, no new elements can be inserted. You must be wondering why?
  2. Undo-redo in software application Multi processor scheduling
  翻译: