lec13 - CSE 12 The Queue ADT The Queue ADT Queue attributes...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
13 The Queue ADT Queue attributes and operations Designing a test plan for Queue CSE 12 The Queue ADT
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Queue ADT Queue : a F irst- I n- F irst- O ut ( FIFO ) data structure the first item put into the structure will be the first item to be taken out of it Values: a sequence of data items of type T Operations: enqueue(T) T dequeue() T peek() boolean isEmpty() int size() these are the essential ones!
Background image of page 2
Examples of Queue applications Operating systems schedulers: processes can be placed in a queue awaiting their turn to use the processor; the process that has been waiting the longest will be selected to run next Print spoolers: print jobs on a first-come-first-served basis Network packet buffering: packets arriving on the input port of a router will be queued up on one of the router’s output port for the next hop Simulations of any queue-like behavior (e.g., planes on a runway, customers in a checkout line)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Queue Properties and Attributes Properties A Queue is a FIFO structure. Considered as a linear structure, an addition is done at one end (the ‘back’ or ‘rear’ or ‘tail’) and a deletion at the other end (the ‘front’ or ‘head’) This queue has a fixed upper bound (capacity) on the number of elements it can store Attributes capacity : The maximum number of elements that can be in the queue size : The number of elements in the queue: 0 ≤ size ≤ capacity front : Indicates the end of the queue from which elements are removed
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/27/2012 for the course CSE 12 taught by Professor Gary during the Fall '08 term at UCSD.

Page1 / 12

lec13 - CSE 12 The Queue ADT The Queue ADT Queue attributes...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online