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

Info icon This 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
Image of page 1

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

View Full Document Right 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.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern