CS112_24_Slides-queues-2

CS112_24_Slides-queues-2 - Simulation using queues. Yinglin...

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

View Full Document Right Arrow Icon
CS112 Fundamentals of Programming Abstractions Simulation using queues. Yinglin Wang CS Dept., SJTU CS112 Fundamentals of Programming Abstractions ordered group of homogeneous items Queues have two ends Input at one end (tail) Remove from other end (head) The element added first is also removed first ( FIFO : First In, First Out). Last in, last out (LILO) Queue Basics
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS112 Fundamentals of Programming Abstractions Application of queues: COMPUTER SIMULATION Queues turn up in many situations in which it is important to maintain a first-in/first out discipline in order to ensure request are treated fairly. Think for a moment how much time is spent in ones daily activities waiting in some form of a queue : waiting for breakfast; stopped at a traffic light; slowed down on the highways and freeways; delayed at the entrance to one's parking facility;queued for a access to an elevator; holding the telephone as it rings, and so on. The list is endless. A common slogan in the U.S Army is, "Hurry up and wait." Such is the nature of the phenomena we which to simulate. . Queues are common in programs that simulate the behavior of waiting lines CS112 Fundamentals of Programming Abstractions A SYSTEM is a collection of interacting parts (real-world process) . General concepts There is a endless variety of real-world events and process that are too complicated to understand completely. e.g. how various pollutants affect the ozone layer and how the changes in ozone layer affect the global climate. A MODEL is a simplification of a system.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/06/2010 for the course CS 112 taught by Professor Yinlinwang during the Spring '08 term at Shanghai Jiao Tong University.

Page1 / 13

CS112_24_Slides-queues-2 - Simulation using queues. Yinglin...

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

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