1 5. Queues Def. As a data structure, a queue is an ordered collection of data items with the property that items can be removed only at one end, called.

Slides:



Advertisements
Similar presentations
Data Structures Through C
Advertisements

Buffers & Spoolers J L Martin Think about it… All I/O is relatively slow. For most of us, input by typing is painfully slow. From the CPUs point.
Computer Science 112 Fundamentals of Programming II Overview of Collections.
Stacks and Queues CSC220 Data Structure Winter
Lecture - 9 On Queues. Prepared by, Jesmin Akhter, Lecturer, IIT,JU QUEUES A Queue is a linear list of elements in which deletions can take place only.
MSc.It :- Ali Abdul Karem Habib Kufa University / mathematics & Science Of Computer.
A stack is a data linear data structure in which addition of new element or deletion of an existing element always takes place at the same end. This.
 Abstract Data Type Abstract Data Type  What is the difference? What is the difference?  Stacks Stacks  Stack operations Stack operations  Parsing.
Queue RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
CS 206 Introduction to Computer Science II 10 / 22 / 2008 Instructor: Michael Eckmann.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Unit : Overview of Queues.
Data Structures: Lists i206 Fall 2010 John Chuang Some slides adapted from Glenn Brookshear, Brian Hayes, or Marti Hearst.
1 Queues CPS212 Gordon College. 2 Introduction to Queues A queue is a waiting line – seen in daily life –Real world examples – toll booths, bank, food.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
1 Queues and Priority Queues Chapter 8. 2 Introduction to Queues A queue is a waiting line – seen in daily life –Real world examples – toll booths, bank,
Device Management.
Queues Chapter 8 Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved
The Stack and Queue Types Lecture 10 Hartmut Kaiser
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 5: Stacks and Queues.
CHAPTER 05 Compiled by: Dr. Mohammad Omar Alhawarat Stacks & Queues.
ISOM MIS 215 Module 3 – Stacks and Queues. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
CHP-4 QUEUE.
1 I/O Management and Disk Scheduling Chapter Categories of I/O Devices Human readable Used to communicate with the user Printers Video display terminals.
Adapted from instructor resources Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Team Project 1 Dr. Sunny Jeong & M.H. Park. Priority Scheduling Define your own priority, at least two According to each priority, implements suitable.
Data Structures: Advanced Damian Gordon. Advanced Data Structure We’ll look at: – Linked Lists – Trees – Stacks – Queues.
Foundation of Computing Systems Lecture 3 Stacks and Queues.
Cousin of the Stack.  An abstract data type (container class) in which items are entered at one end and removed from the other end  First In First.
CSS446 Spring 2014 Nan Wang  Java Collection Framework ◦ Stack ◦ Queue & Priority Queue 2.
Queue Queue: –Like any other data structure (apart from Array and Linked List), Queue also can be implemented, –Either as an Array or, –As a Linked List.
Data Structures Chapter 6. Data Structure A data structure is a representation of data and the operations allowed on that data. Examples: 1.Array 2.Record.
Queues. Like Stacks, Queues are a special type of List for storing collections of entities. Stacks are Lists where insertions (pushes) and deletions (pops)
1 Algorithms Queues, Stacks and Records stored in Linked Lists or Arrays.
Queues Chapter 5 Queue Definition A queue is an ordered collection of data items such that: –Items can be removed only at one end (the front of the queue)
ITEC 2620M Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: ec2620m.htm Office: Tel 3049.
FALL 2005CENG 213 Data Structures1 Priority Queues (Heaps) Reference: Chapter 7.
Introduction Of Queue. Introduction A queue is a non-primitive linear data structure. It is an homogeneous collection of elements in which new elements.
Computer Engineering Rabie A. Ramadan Lecture 6.
COSC 2P03 Week 21 Stacks – review A Last-In First-Out (LIFO) structure Basic Operations: –push : insert data item onto top of stack –pop : remove data.
CHP-4 QUEUE Cont…. 7.DEQUE Deque (short form of double-ended queue) is a linear list in which elements can be inserted or deleted at either end but not.
CHAPTER 5 QUEUE v2 by Queue in C++ [Non-English] It is an ordered group of homogeneous items of elements. [English] –You go to the shopping.
 In general, Queue is line of person waiting for their turn at some service counter like ticket window at cinema hall, at bus stand or at railway station.
DATA STRUCURES II CSC QUIZ 1. What is Data Structure ? 2. Mention the classifications of data structure giving example of each. 3. Briefly explain.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
© 2004 Goodrich, Tamassia Queues. © 2004 Goodrich, Tamassia Stacks2 The Queue ADT The Queue ADT stores arbitrary objects Insertions and deletions follow.
1 Priority Queues (Heaps). 2 Priority Queues Many applications require that we process records with keys in order, but not necessarily in full sorted.
BCA II Data Structure Using C
Data Structures Using C, 2e
Queues.
Lesson Objectives Aims Key Words
Objectives In this lesson, you will learn to: Define stacks
Lectures Queues Chapter 8 of textbook 1. Concepts of queue
Stacks and Queues.
Algorithm and Data Structure Part III Dr. Naimah Yaakob
Queues Chapter 8 Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved
QUEUE.
Queues.
Queues 11/9/2018 6:32 PM Queues.
Chapter 15, Exploring the Digital Domain
Nachos Assignment#2 Priority Scheduling.
Processor Fundamentals
CSC 143 Queues [Chapter 7].
ITEC 2620M Introduction to Data Structures
EE 472 – Embedded Systems Dr. Shwetak Patel.
QUEUE Visit for more Learning Resources Free Powerpoint Templates.
[Most of the details about queues are left for to read about and work out in Lab 6.] Def. As a data structure, a queue is an ordered collection of data.
Abstract Data Types (ADTs)
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

1 5. Queues Def. As a data structure, a queue is an ordered collection of data items with the property that items can be removed only at one end, called the front of the queue, and items can be added only at the other end, called the back of the queue. Basic operations are: construct:Create an empty queue empty:Check if a queue is empty addQ:Add a value at the back of the queue front:Retrieve the value at the front of the queue removeQ:Remove the value at the front of the queue Whereas a stack is a Last-In-First-Out (LIFO) structure, a queue is a ________________________________________ or _________________________________________ structure. [Most of the details about queues are left for to read about and work out in Lab 6.]

2 2. Examples: a. I/O buffers: queues, scrolls, deques  From a file: (queue)

3  Interactively: (scroll — queue on one end, stack on the other

4  Screen handling: (deque — double-ended queue)

5 b.Scheduling queues in a multi-user computer system:  Printer queue: When files are submitted to a printer, they are placed in the printer queue. The printer software executes an algorithm something like: for (;;) { while (printerQueue.empty()) sleep 1; printFile = printerQueue.removeQ(); Print(printFile); }

6  Other Queues: Resident queue:____________________________________________ Ready queue:____________________________________________ ________________________________ Suspended queue:____________________________________________

7 c. CPU Scheduling: Probably uses a ____________ ______________: Items with lower priority are behind all those with higher priority. (Usually a new item is inserted behind those with the same priority.)