Applications of Queue data structure - cook the code

Thursday 28 December 2017

Applications of Queue data structure

Applications of Queue

Queue, as the name suggests is used whenever we need to manage any group of objects in an order in which the first one coming in, also gets out first while the others wait for their turn, like in the following scenarios :
  1. Serving requests on a single shared resource, like a printer, CPU task scheduling etc.
  2. In real life scenario, Call Center phone systems uses Queues to hold people calling them in an order, until a service representative is free.
  3. Handling of interrupts in real-time systems. The interrupts are handled in the same order as they arrive i.e First come first served.
  4. Queue is used in BFS(Breadth First Search) algorithm. It helps in traversing a tree or graph.
queue


A real-world example of queue can be a single-lane one-way road, where the vehicle enters first, exits first. More real-world examples can be seen as queues at the ticket windows and bus-stops.
Vehicle on Road


No comments:

Post a Comment