You are on page 1of 2

Applications of Queue data structure

 Queue is useful in CPU scheduling, Disk Scheduling. When multiple


processes require CPU at the same time, various CPU scheduling algorithms
are used which are implemented using Queue data structure.
 When data is transferred asynchronously between two processes.Queue is
used for synchronization. Examples : IO Buffers, pipes, file IO, etc.
 In print spooling, documents are loaded into a buffer and then the printer
pulls them off the buffer at its own rate. Spooling also lets you place a
number of print jobs on a queue instead of waiting for each one to finish
before specifying the next one.
 Breadth First search in a Graph .It is an algorithm for traversing or
searching graph data structures. It starts at some arbitrary node of a graph
and explores the neighbor nodes first, before moving to the next level
neighbors.This Algorithm uses Queue data structure.
 Handling of interrupts in real-time systems. The interrupts are handled in
the same order as they arrive, First come first served.
 In real life, Call Center phone systems will use Queues, to hold people
calling them in an order, until a service representative is free.

Applications of stack

1. used in "undo" mechanism in text editor.

2. Language processing:

 space for parameters and local variables is created internally using a stack.
 compiler's syntax check for matching braces is implemented by using stack.
 support for recursion.
 Expression evaluation like postfix or prefix in compilers.
3. Backtracking (game playing, finding paths, exhaustive searching.

4. Memory management, run-time environment for nested language features. etc

Applications of Queue

1. When a resource is shared among multiple consumers. Examples include


CPU scheduling, Disk Scheduling.
2. When data is transferred asynchronously (data not necessarily received at
same rate as sent) between two processes. Examples include IO Buffers, pipes,
file IO, etc.
3. used in graph traversal algorithms
4. used in recognizing palindrome
5. used in simulations,etc

You might also like